https://developer.mozilla.org/en-US/docs/Tools/Remote_Debugging/Firefox_for_Android

This guide explains how to use remote debuggingto inspect or debug code running inFirefox for Androidover USB.

This guide's split into two parts: the first part, "Prerequisites" covers stuff you only need to do once, while the second part, "Connecting", covers stuff you need to do each time you connect the device.

Prerequisites

First, you'll need:

  • a desktop or laptop computer with Firefox running on it
  • an Android device capable of running Firefox for Android with Firefox for Android running on it
  • a USB cable to connect the two devices

ADB setup

Next, you'll need to get the desktop and the Android device talking to each other using the adb command-line tool.

On the Android device

On the desktop

  • Install the correct version of the Android SDK for your device.
  • Using the Android SDK, install the Android Platform Tools.
  • Android Platform Tools installs adb in the "platform-tools" directory under the directory in which you installed the Android SDK. Make sure the "platform-tools" directory is in your path.

To check it worked, open up a command shell on the desktop and type:

adb devices

You should see some output like:

List of devices attached
51800F220F01564 device

(The long hex string will be different.)

If you do, then adb has found your device and you've successfully set up ADB.

Enable remote debugging

Next, you need to enable remote debugging on both the Android device and the desktop.

Firefox for Android 24 and earlier

To enable remote debugging on the device, you need to set thedevtools.debugger.remote-enabled preference to true.

Go to about:config in Firefox for Android, type "devtools" into the search box and press the Search key. You'll see all the devtools preferences. Find thedevtools.debugger.remote-enabled preference, and press "Toggle".

Firefox for Android 25 and later

On Firefox for Android 25 and later, there's a menu item to enable remote debugging. Open the menu, select "Settings", then "Developer tools" (on some Android devices you may need to select "More" to see the "Settings" option). Check the "Remote debugging" box:

The browser will display a notification reminding you to set up port forwarding, which we'll do later on.

On the desktop

On the desktop, remote debugging is enabled by a setting in the Toolbox. Open the Toolbox, click the "Settings" button in the toolbar, and check "Enable remote debugging" in the Settingstab:

If you're using a version of Firefox older than 27, you'll need to restart the browser for the setting to take effect.

You'll then see a new option in the Web Developer menu labeled "Connect...":

Connecting

Now you can connect the remote debugging tools to the device. First, attach the device to the desktop with a USB cable, if you haven't already.

On the desktop

Go to a command prompt, and type:

adb forward tcp:6000 tcp:6000

(If you've changed the value the Android device uses for a debugging port, you'll need to adjust this accordingly.)

For Firefox OS, type:

adb forward tcp:6000 localfilesystem:/data/local/debugger-socket

You'll need to reissue this command each time you physically attach desktop and device with the USB cable.

Then go to the Web Developer menu on Firefox, and select "Connect...". You'll see a page that looks like this:

Unless you've changed the port numbers, choose 6000 and press the "Connect" button.

On the Android device

Next you'll see a dialog on the Android device asking you to confirm the connection:

Press "OK". The desktop waits for a few seconds to give you time to acknowledge this dialog: if it times out, just press "Connect" in the desktop dialog again.

On the desktop

Next, the desktop shows you a dialog that looks something like this:

This is asking whether you want to debug web content running in a browser tab, or to debug the browser code itself.

  • You'll see one entry under "Available remote tabs" for each open tab, and clicking it will attach the debugging tools to the web content hosted by that tab. If you want to debug your web content, you'll choose the relevant content tab.
  • You'll see one entry under "Available remote processes": this is the browser process itself. You'll choose this option if you want to debug the browser's own code.

Let's choose to attach to the mozilla.org website. The Toolbox will open in its own window, attached to the Firefox for Android tab that's currently hosting mozilla.org:

The Toolbox, and the tools it hosts, work in just the same way as they do when attached to local content.

Attachments

File Size Date Attached by
remote-debugger-about-config-toggle

 
95831 bytes 2013-08-01 15:36:19 wbamberg
remote-debugging-connect-menuitem

 
81023 bytes 2013-08-01 17:15:16 wbamberg
remote-debugging-deskopt-connect

 
85186 bytes 2013-08-01 17:20:07 wbamberg
remote-debugging-device-connect

 
167472 bytes 2013-08-01 17:26:11 wbamberg
remote-debugging-deskopt-select-target

 
90358 bytes 2013-08-01 19:41:30 wbamberg
remote-debugging-console

 
124892 bytes 2013-08-01 20:35:29 wbamberg
remote-debugging-debugger

 
266637 bytes 2013-08-01 20:35:45 wbamberg
remote-debugger-toolbox-settings

 
123586 bytes 2013-08-01 23:09:18 wbamberg
remote-debugging-device-enable

 
45182 bytes 2013-08-02 09:37:26 wbamberg
remote-debugging-overview

 
394293 bytes 2013-08-02 12:25:02 wbamberg

FireFox调试手机浏览器的更多相关文章

  1. web端 调试 手机混合应用中的h5部分(chrome浏览器的devtool使用)

    Learning Hybird App Test–Appium Java(Leyden) 浏览器的远程调试工具,使得我们可以通过PC上开启的控制台,调试手机浏览器中正在运行的代码.运行于 Androi ...

  2. UC浏览器开发者版调试手机页面

    1 关于RI 目前,在手机上使用浏览器访问网页,无法便捷地进行网页语言调试.手机屏幕相对较小且操作不便,直接在手机上进行网页数据调试不太现实. 因此,我们使用技术将手机网页调试信息分离,实现一种能在大 ...

  3. 通过chrome浏览器调试手机页面(IOS和Android)

    开发PC页面的时候使用chrome浏览器的开发者工具,可以很容易的捕获到页面的dom元素,并且可以修改样式,方便调试,但是手机上却很麻烦,因为手机上没有办法直接打开开发者工具查看元素.其实可以通过将设 ...

  4. Fiddler4工具配置及调试手机和PC端浏览器

    Fiddler最大的用处: 模拟请求.修改请求.手机应用调试 Fiddler最新版本 下载地址: http://www.telerik.com/download/fiddler Fiddler 想要监 ...

  5. 在PC机上,如何用Chrome浏览器模拟查看和调试手机的HTML5页面?

    如题,如何用PC机上的Chrome浏览器模拟查看和调试手机HTML5页面? 参考操作步骤如下: 第一步.用Chrome打开要调试的页面: 第二步.按F12,打开“开发者工具”,点击其右上角的“Dock ...

  6. 在PC上测试移动端网站和模拟手机浏览器的5大方

    查了很多资料,尝试了大部分方法,下面将这一天的努力总结下分享给大家,也让大家免去看那么多文章,以下介绍的方法,都是本人亲自测试成功的方法,测试环境winxp. 一.Chrome*浏览器 chrome模 ...

  7. 在PC上测试移动端网站和模拟手机浏览器的5大方法

    在PC上测试移动端网站和模拟手机浏览器的5大方法 来源:互联网 作者:佚名 时间:03-19 10:14:54 [大 中 小]                最近公司要开发网站的移动版,让我准备准备知 ...

  8. Opera浏览器测试移动端网站和模拟手机浏览器的方法

    链接地址:http://www.neirong.org/post-256.html?utm_source=tuicool Chrome浏览器请看:Chrome浏览器测试移动端网站和模拟手机浏览器的方法 ...

  9. 【转】在PC上测试移动端网站和模拟手机浏览器的5大方法

    查了很多资料,尝试了大部分方法,下面将这一天的努力总结下分享给大家,也让大家免去看那么多文章,以下介绍的方法,都是本人亲自测试成功的方法,测试环境winxp. 一.Chrome*浏览器 chrome模 ...

随机推荐

  1. shell注释

    sh里没有多行注释,只能每一行加一个#号.只能像这样: #-------------------------------------------- # 这是一个自动打ipa的脚本,基于webfrogs ...

  2. Swift与C#的基础语法比较

    背景: 这两天不小心看了一下Swift的基础语法,感觉既然看了,还是写一下笔记,留个痕迹~ 总体而言,感觉Swift是一种前后端多种语言混合的产物~~~ 做为一名.NET阵营人士,少少多多总喜欢通过对 ...

  3. 深入理解DIP、IoC、DI以及IoC容器

    摘要 面向对象设计(OOD)有助于我们开发出高性能.易扩展以及易复用的程序.其中,OOD有一个重要的思想那就是依赖倒置原则(DIP),并由此引申出IoC.DI以及Ioc容器等概念.通过本文我们将一起学 ...

  4. Linux虚拟机的安装(使用Centos6.3)

    1.什么是虚拟机? 虚拟机指通过软件模拟的具有完整硬件系统功能的.运行在一个完全隔离环境中的完整计算机系统 2.安装Linux虚拟机前要做的准备 2.1:一台windows环境的pc 2.2:下载VM ...

  5. 小白解决CENTOS7错误:Cannot find a valid baseurl for repo: base/7/x86_6

    刚入手的MacBook想着学点东西,本汪还是决定玩玩CentOS服务器,安装好了VirtualBox + CentOS. 打开一看,懵逼了!命令行! 行吧,先装个图形界面: $sudo yum gro ...

  6. Yeoman 官网教学案例:使用 Yeoman 构建 WebApp

    STEP 1:设置开发环境 与yeoman的所有交互都是通过命令行.Mac系统使用terminal.app,Linux系统使用shell,windows系统可以使用cmder/PowerShell/c ...

  7. python 入门笔记

    1.pip包安装 pip install *** pip 中http和https代理设置(/etc/profile) 2.强制保存 :w !sudo tee % 3.cffi是python调用C的包 ...

  8. Javascript 严格模式详解

    转自http://www.ruanyifeng.com/blog/2013/01/javascript_strict_mode.html 一.概述 除了正常运行模式,ECMAscript 5添加了第二 ...

  9. css3更改input单选和多选的样式

    在项目开发中我们经常会遇到需要更改input单选和多选样式的情况,今天就给大家介绍一种简单改变input单选和多选样式的办法. 在这之前先简单介绍一下:before伪类 :before 选择器向选定的 ...

  10. ADFS3.0与SharePoint2013安装配置(原创)

    现在越来越多的企业使用ADFS作为单点登录,我希望今天的内容能帮助大家了解如何配置ADFS和SharePoint 2013.安装配置SharePoint2013这块就不做具体描述了,今天主要讲一下怎么 ...