Javascript: running on mobile but not on desktop(chrome, opera, safari)

时间:2015-06-25 18:58:54

标签: javascript

I'm working with the HTML5 geolocation api. I'm getting a weird error. i got a function called doGeolocate that is called when the user land on the page. That load the map with the wright location data. And i got a button that recall the same function when ever the user want to recenter the map. But when a user tap the button on a desktop(chrome,opera, safari) except firefox it doesn't work. While on the other there is no problem. Once debug it seem like the code locationCallback isn't call properly the second time even tho it is on load. doGeolocate: function(){ if (navigator.geolocation) { console.log("doGeolocate"); var locationCallback = helper.callback(this, function(position) { this.initialGeolocationPosition(position); if(!this.positionMarker){ this.createPositionMarker(position); } }); var err = function(err) { console.log(""); }; var options = { maximumAge: 0 }; navigator.geolocation.getCurrentPosition(locationCallback,err,options); } },

0 个答案:

没有答案
相关问题