Is javascript geolocation inside an html5 page calculated different for each mobile browser? -
if insert following code html5 page geolocation work on safari ios, android , blackberry browsers?
getviahtml5 = function(done) { if(navigator.geolocation) { navigator.geolocation.getcurrentposition(function(position) { vicinity.lat = position.coords.latitude; vicinity.lng = position.coords.longitude; done(); }, function(e) { console.warn('error(' + e.code + '): ' + e.message); }); } else { console.warn("browser doesn't support geolocation"); } };
i'm not asking if actual code correct. i'm asking if javascript geolocation on html5 page work various mobile browsers or there different method each browser (safari ios, android , blackberry browsers)
there 2 methods: html5 geolocation api, , polyfill(s) rest.
android, , mobile safari go; had blackberry, you're good:
http://developer.blackberry.com/html5/apis/v1_0/navigator.geolocation.html
depending on version(s) of ie support, modernzr handles ie8 , up.
if need below ie8 use geolocation fallback library:
https://github.com/estebanav/javascript-mobile-desktop-geolocation/
Comments
Post a Comment