How to debug JavaScript code with mobile browsers

I know about firebug and the developer tools for the major modern desktop browsers, but I can't find any way of debugging JavaScript code on mobile browsers.

What are some high level techniques I can use to debug code on mobile browsers?


Android devices can be put into developer mode by going through settings>Phone status then tapping on "Build number" 7 times. This allows you to do a bunch of things (see step 5) including USB debugging. (Some devices might have Build number under Software Info)

To activate USB debugging, look in Settings for the newly appeared "{ } Developer Options", open this and switch on USB debugging. Connect your device using a direct USB connection.

In Chrome on your desktop, in the usual developer tools panel used for debugging, look in the menu for more tools>remote devices. With Discover USB devices selected, you should now see your mobile device on the side.

Select it to see a list of all the chrome tabs you have open and the ability to enter URLs directly.

Selecting one of the links will open up a new window with a mirror of your device screen on the left and all the familiar chrome debug tools on the right. You can still control your device directly or use the mouse on the mirrored screen. It even rotates.

full details on remote debugging from google and how to enable developer mode (link as above) from askvg.com


Android provides a tool set for these purposes: https://developers.google.com/web/tools/chrome-devtools/remote-debugging/?utm_source=dcc&utm_medium=redirect&utm_campaign=2016q3

Apple does it a similar way: https://developer.apple.com/safari/tools/

Tutorial: https://css-tricks.com/using-chrome-devtools-to-debug-javascript-in-any-browser-with-ghostlab-2/


You can debug on Safari Mobile with any iPhone/iPad. In Developer menu you can find your device and you can then debug your code with inspector.

If you have an Android Device instead, you can debug on Chrome Desktop (remember to active the debug mode) with chrome://inspect


On the IPhone you can go into settings>Safari>advanced and turn web inspector on