javascript - How to detect the status of the element navigation in js? -


i need users latitude , longitude browser, on of browsers restrictions doesn't let it. how tell users geolocation off or doesn't support it?

i tried this, neither ipad or safari on mac prompt anything.

if (navigator.geolocation)     navigator.geolocation.getcurrentposition(success); else     alert('not supported'); 

demo: http://jsfiddle.net/7srds/

if (navigator.geolocation) {      navigator.geolocation.getcurrentposition(function(position) {           // ...      }, function(error) {         //error handling         switch(error.code) {             case error.permission_denied:               //user denied request geolocation.                            break;             case error.position_unavailable:               //location information unavailable.               break;             case error.timeout:               //the request user location timed out.               break;             case error.unknown_error:               //an unknown error occurred.               break;         }         alert("geolocation error: " + error.code);     },     {         timeout:10000 //10s     }); } else {     alert("geolocation services not supported browser."); }  

Comments

Popular posts from this blog

java - activate/deactivate sonar maven plugin by profile? -

python - TypeError: can only concatenate tuple (not "float") to tuple -

java - What is the difference between String. and String.this. ? -