javascript - Client Location Detection Works on Safari Desktop But Not Safari Mobile -


i'm trying set client location detection mobile web site using code below:

<html>    <head>    </head>    <body>       <script type="text/javascript" src="http://www.google.com/jsapi"></script>       <script type="text/javascript" src="http://maps.google.com/maps/api/js?sensor=false&libraries=geometry"></script>       <script>          var geocoder = new google.maps.geocoder();          var loc = {};          if(google.loader.clientlocation) {          loc.lat = google.loader.clientlocation.latitude;          loc.lng = google.loader.clientlocation.longitude;          }          var clientlocation = new google.maps.latlng(loc.lat, loc.lng);          alert(clientlocation);       </script>    </body> </html> 

this works fine on safari on desktop returns (nan,nan) when run on safari mobile browser. can suggest might going wrong?

i believe above code works.

i tested on iphone 5 using safari, , works okay.

are sure have location services enabled on iphone safari? make sure haven't turned them off.


Comments

Popular posts from this blog

Detect support for Shoutcast ICY MP3 without navigator.userAgent in Firefox? -

web - SVG not rendering properly in Firefox -

java - JavaFX 2 slider labelFormatter not being used -