How to check window object for mobile safari?

How to check window object for mobile safari?

Or, more specifically, window.navigator - trying to convert to a string does not work, and I cannot examine it in the console.

Thank!

EDIT:

console.log(window.navigator);

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

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

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

I also tried to send all these options via socket to the server and register them there.

Output: [object Navigator] , "{}" or nothing

+11
javascript jquery safari iphone mobile
Jun 01 '11 at 19:26
source share
5 answers

I like jsconsole.com.

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

 console.log(JSON.stringify({a:'a',b:'b'}); 
+4
Jun 01 '11 at 19:39
source share

Refresh !!! In OS X, you can use Safari Web Inspector on iOS Simulator and iOS 6 devices.

  • First enable the Developer menu in Safari.
  • Then enable remote debugging on your iOS device (or simulator).

     Settings > Safari > Advanced > Web Inspector (ON) 
  • Return to Safari on your device.
  • Return to your computer, open the Developer menu and select devices (for example, iPhone Simulator, iPhone).

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

Enjoy it!

+35
Oct. 06 '12 at 18:10
source share

Those results look completely correct. For example, when I request a lowercase version of window.navigator , I get correctly

 console.log(String(window.navigator)); "[object Navigator]" 

On the other hand, when I request a specific value, I get (in Chromium):

 console.log(window.navigator.userAgent); "Mozilla/5.0 (X11; Linux i686) AppleWebKit/534.24 (KHTML, like Gecko) Chrome/11.0.696.71 Safari/534.24" 

And when I try to list all the elements, I get

 for (var i in window.navigator) console.log(i); language product mimeTypes appVersion plugins onLine platform vendor appCodeName cookieEnabled geolocation appName productSub userAgent vendorSub javaEnabled getStorageUpdates 

(remember that in the line of code above, I did not check hasOwnProperty , which you usually should use when iterating over objects).

+1
Jun 01 2018-11-21T00:
source share

You can also use this to activate Firebug on your device. I had a lot of time to find this.

http://martinkool.com/post/13629963755/firebug-on-ipad-and-iphone

+1
Feb 06 '14 at
source share

There is no developer tool window on mobile safari. There is a debug console that will report bugs in javascript, html and css, but it is not next to the developer tools that you will find in the desktop browser. This debugging console does not allow javascript to be entered (although this can be done in the address bar, for example javascript:alert("hi"); )

To enable the debug console, open the settings application, go to the Safari menu, then Developer , and then turn on the debug console. Go back to Safari, go to the top of the page, and it will be obvious what to do to get to the Debug console.

0
Jun 01 '11 at 19:40
source share



All Articles