Start mobile browsers with webkit remote debugging ON - mobile

At Google I/O 2011: Chrome Dev Tools Reloaded, Paul Irish and Pavel Feldman introduced new remote debugging feature — which was in passing included into webkit.
--
This is great news, particularly for mobile web-developers.
But how do we enable it, for example launching IOS simulator, or just running Safari Mobile on an iPhone? (for chrome this is traditionally done with --remote-debugging-port=9222 option while launching it).
I tried enabling developer mode in safari settings (Settings > Safari > Developer > Debug Console: ON) but without success...
I don't know about android here, but does anyone know when Apple (Safari Mobile) or Google (android's browser) will include this new feature so we can enjoy remote-debugging in mobile development?
Thank you.
Ref: http://paulirish.com/2011/a-re-introduction-to-the-chrome-developer-tools/#comment-63113

Safari on iOS 6
In iOS6 you can now remote debug from Safari 6 (only OS X). On the device, open Settings > Safari > Advanced > Enable Web Inspector. Open Safari Preferences, Advanced, check "Show Develop menu in menu bar". Connect your iPhone/iPad with a USB cable. Now under the Develop menu bar you should get a submenu for you device with the tabs you have open in Safari on your device.
Safari on iOS 7
In addition to requirements above you will need Safari 6.1, which at the moment (Oct. 8th 2013) is only available as a seed for developers: https://developer.apple.com/downloads/index.action?name=Safari%206.1
Chrome on Android 4
It's a bit more complicated on Android. Instructions for remote debugging on Chrome for Android here: https://developers.google.com/chrome/mobile/docs/debugging
I haven't found a way to enable remote debugging in the Android default browser (v4.04).

Take a look at this bash script to start the remote inspector with iOS simulator: https://gist.github.com/2241976

It's now supported in Chrome for Android.

Currently no mobile browser is implementing the webkit remote debugging protocol. (Maybe you can get custom builds for android that support it)
However there is weinre, which is giving you a remote version of the web-inspector. But you have to include some code in your page in order to support it. (Because it's not a browser feature).
Weinre website
Weinre github repo

Just because a feature is implemented in one port of WebKit (in this case, Apple and Chromium), does not mean it is always available elsewhere. I wrote this in details in my blog post about different WebKit ports implementation.
So far, the only mobile WebKit port which has the remote debugging feature is RIM Playbook browser.
For iOS, it is very difficult to know because Apple does not give any information about its future product ever. At least we know that iOS 5 will not have it since the beta versions do not show anything related.
For Android, definitely it is coming in a future release, since Android folks are adopting Chromium as the new basis for its WebKit.

Nathan de Vries figured out how to do this on iOS5 running in the simulator. It revolves around calling the private _enableRemoteInspector method.
Read it. Summary follows:
To enable this for Mobile Safari, attach to it with gdb and call the method:
MobileSafari_PID=$(ps x | grep "MobileSafari" | grep -v grep | awk '{ print $1 }')
if [ "$MobileSafari_PID" == "" ]; then
echo "Mobile Safari.app must be running in the Simulator to enable the remote inspector."
else
cat <<EOM | gdb -quiet > /dev/null
attach $MobileSafari_PID
p (void *)[WebView _enableRemoteInspector]
detach
EOM
fi
Then access the inspector at http://localhost:9999/.
With an embedded UIWebView, enable it like this:
- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions {
// ...Snipped...
[NSClassFromString(#"WebView") _enableRemoteInspector];
// ...Snipped...
}
On a real device it doesn't work, probably because the port is firewalled - if you have a jailbroken device you may get around that (update us if you do).

Thomas points out an excellent resource for remote debugging, however he states that you need to add the code to the webpage. This is not strictly true, as weinre also allows interaction through bookmarklets. Part way down the page here (under the section conveniently called "Using a bookmarklet"), it says it should work for Android 2.2+ and iOS.
Some relevant things to note:
It will not allow you to debug start errors (page already has to be loaded to open the bookmarklet).
It doesn't seem to reconnect if you lose connection (you have to refresh the page to get the connection again).
If your js is broken already, it will already be broken as well.
It is also possible (I have done it myself) to 'debug' code from the android browser using a webview. You can have the webview catch all method calls (ie. console.log). Using that you can catch and save, or forward the messages to logcat.
Related to the method you have already tried - when you enabled the Debug console on iOS, where were you looking for interaction/logging output? More particularly, did you check in the debugging console in xCode/iPhone simulator?

Adobe's Shadow utility (which was just released) allows you to debug remotely using weinre without needing to inject any code into your web pages. It works with Chrome on Windows and Mac as the "master" browser and will sync every page navigation over to any number of devices running the iOS or Android client.
Note that weinre itself is somewhat limited. For example you won't have access to the Network tab.

Related

Debbugging angularjs app without ripple or browser because it uses cordovasqlite plugin

In my AngularJS/Ionic app I use the cordova-sqlite plugin and a local database to store data; I also use a web service to fill the database with data from a remote database. Well, sometimes I get a strange behaviour when I try to get data from the remote database.
My problem is that I can't debug the code in the way it is now.
If I try to use the ripple emulator it says that it can't work with the sqlite plugin. I googled around and found out that any plugin which uses native code won't work with ripple. I wanted to see the network transferring operations on ripple.
At the time Im writing this I'm usually debugging opening the system console and checking them out but this isn't a really good way to debug. I work on a mac with WebStorm.
Is there a way to debug my code on mac live on the device or simulator like in visual studio?
Have you tried GapDebug? It let's you debug your Cordova/Phonegap app on an Android or iOS device via Chrome Dev Tools or Safari Webkit Inspector and is almost magical. -> https://www.genuitec.com/products/gapdebug/

Blackberry Z10 Mobile Menu links not working

I can't figure out what is causing this issue on the BlackBerry Z10 where the mobile menu that I created for disinherited.com won't properly function as links.
The menu items won't click through to their href's or show their dropdown menus(javascript).
It works well on a number of other browsers and devices. This is just one that won't work.
Anybody have any suggestions as to what browser compatibility issues I might be missing?
The "About Us" link doesn't do anything for me (even on Desktop browsers).
I would guess that there might be some CSS (a layer maybe) that is interfering with the click/action event. I would suggest connecting remote web inspector to see what exactly is going on.
Did you know that BlackBerry 10 has some of the best remote web debugging capabilities?
Plug your device in via USB
Enable Settings -> Developer Mode
Open http://disinherited.com in the BlackBerry browser
from your desktop browser, open http://169.254.0.1:1337
You are connected to the live content, running on the BlackBerry, from your desktop browser. From there, you can inspect, debug, profile what your website is doing.

Randomly missing ESI content on tablet and mobile devices using Symfony2 and varnish

I have a weird issue where some content included via Edge Side Include is randomly missing. Its a menu wrapped in a header tag. Sometimes it displays in the browser sometimes its missing.
A few notes:
1) This only happens on mobile and tablet devices. I have been able to reproduce the error on an ipad, blackberry torch and an android phone (Samsung galaxy s3) using the default android browser, firefox and chrome for android.
2) I installed the Android SDK for debugging but received no errors. The only thing I found was everytime the header was missing there were also no cookies set which is odd. And then when the header was displayed there were cookies set.
3) The problem can be rectified by clearing all web data in the browser (cookies, cache etc).
The application is written in Symfony2.1
The reverse proxy server is Varnish
Any ideas?

How to debug application in extjs in internet explorer and Google chrome browser

Can anybody tell How to debug application in extjs in internet explorer and google chrome Browser? is it possible using Breakpoints to debug to check the values?
Thanks
There is a good article provided by sencha. check the section for internet explorer, http://www.sencha.com/learn/debugging-ext-js-applications
I have been forced to use IE8 in an application which works in Chrome and Firefox but fails often in IE8.
Debugging ExtJS in IE8 is nearly impossible if the problem is in the framework. IE8's developer tools hangs loading ext-all-dev.js
Also you can't get stack trace as in Chrome.
I had to put alert() calls in suspect lines and the whole process is a nightmare.
If you can avoid IE, do it.
Else be VERY VERY patient...
You can use the Developer Tools for your browsers. I don't use IE but I use Chrome's Developer Tools all the time! And yes you can do breakpoints, check values, etc..

Any local browsers which pretend to be mobile?

I'm currently developing a mobile site and I'm finding it very clunky to work with a browser through an emulator.
Is there any way I can make a browser (which runs on OSX) "pretend" it is a mobile browser so that I can get mobile html back from the site I'm guessing things like inspect in chrome or firebug on firefox?
NOTE: I really wish I could have accepted all of the answers.
I think you can change the User-Agent of the browser and then, the server will send you, if a mobile version is available - this one!
Like stylesheets etc.
There is a nice addon for firefox called "User Agent Switcher"
For Safari;
In the normal Mac OS X Safari, go to Preferences/Advanced and check "Show develop menu in menu bar". A menu called "Develop" will show up with a sub menu called "User Agent". In that you can choose to send user agent strings for - for example - iPhone and iPad.
The develop menu also has a "Web inspector" which while not as powerful as FireBug is pretty good for inspecting the results.

Resources