Debugging Chrome for iOS
Thursday, 19 February 2015
Recently I had a weird rendering problem that only happened on Chrome for iOS and needed access to developer tools (debugger, DOM inspector, etc).
I knew about Safari for Mac allowing you to debug via USB and I had read that this also worked with any app that used any UIWebView .
But for some reason it didn’t work for Chrome. So I kept looking and found weinre :
weinre is a debugger for web pages, like FireBug (for FireFox) and Web Inspector (for WebKit-based browsers), except it’s designed to work remotely, and in particular, to allow you debug web pages on a mobile device such as a phone.
The basic steps to get it working:
-
Install it via node package manager:
sudo npm -g install weinre
-
Run it on the console:
weinre --boundHost <IP ADDRESS OF THE WEB SERVER>
-
Link the website you want to debug to weinre by adding this to the page
<script src="http://<IP ADDRESS OF THE WEB SERVER>:8080/target/target-script-min.js"></script>
-
Load weinre’s remote debugger on your browser at
http://<IP ADDRESS OF THE WEB SERVER>:8080/client/
-
Reload your website.
I used<IP ADDRESS OF THE WEB SERVER>
everywhere, in my case it was the local IP of my development machine.
weinre worked nicely for me, and fast too. Can’t complain.
Now about the name:
weinre is WEb INspector REmote. Pronounced like the word “winery”. Or maybe like the word “weiner”. Who knows, really.
Yeah… naming things is hard.