Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How can I inspect the window object for mobile safari?

How can I inspect the window object for mobile safari?

Or more specifically window.navigator - trying to convert to string doesn't work and I can't explore it within the console either.

Thanks!

EDIT:

console.log(window.navigator);

console.log(String(window.navigator));

console.log(JSON.stringify(window.navigator));

console.log(window.navigator.serialize());

Also tried sending all these variations over the socket to the server and logging them there.

Output is either [object Navigator], "{}", or nothing

like image 275
fancy Avatar asked Jun 01 '11 19:06

fancy


People also ask

How do you inspect in Mobile Safari?

The steps to do so are as follows: Open Safari browser. Click on Safari > Preferences > Advanced. Tick the checkbox Show Develop menu in the menu bar.

How do I inspect Safari on my tablet?

With Safari open, select the Develop menu in the menu bar. Toward the top of that list, you should see your device's name and the windows that are available to inspect. Select the page or application to inspect, and the inspection window will open.


2 Answers

Update!!! On OS X you can use the Safari web inspector on the iOS Simulator AND iOS 6 devices.

  1. First enable the Developer menu in Safari.
  2. Next, enable remote debugging on your iOS device (or simulator).

    Settings > Safari > Advanced > Web Inspector (ON)
    
  3. Go back to Safari on your device.
  4. Go back to your computer, click the Developer menu, and select your device (e.g. iPhone Simulator, iPhone)

Note: You'll see your device in the Developer menu ONLY when Safari is active and running.

Enjoy!

like image 197
Blaine Avatar answered Oct 16 '22 10:10

Blaine


I like jsconsole.com.

Also, you can use the json2.js library (https://github.com/douglascrockford/JSON-js), which will give you JSON.stringify() function.

console.log(JSON.stringify({a:'a',b:'b'});
like image 25
Teddy Avatar answered Oct 16 '22 08:10

Teddy