firefox - How to add location-aware browsing in website? -
if open website http://www.reebok.com/ru-ru/search/?q=mens in firefox there popup asking me share location. here link http://www.mozilla.org/en/firefox/geolocation/ how can add in website?
i guess reebok site using html5 geolocation api.
try code below , should recreate behaviour. code taken directly page.
https://developer.mozilla.org/en-us/docs/web/api/geolocation.getcurrentposition
var options = { enablehighaccuracy: true, timeout: 5000, maximumage: 0 }; function success(pos) { var crd = pos.coords; console.log('your current position is:'); console.log('latitude : ' + crd.latitude); console.log('longitude: ' + crd.longitude); console.log('more or less ' + crd.accuracy + ' meters.'); }; function error(err) { console.warn('error(' + err.code + '): ' + err.message); }; navigator.geolocation.getcurrentposition(success, error, options);
Comments
Post a Comment