0
這是我用於獲取位置的代碼。但不幸的是,它總是打印「失敗回撥」。navigator.geolocation.getcurrentposition不在safari中工作
var location_timeout = setTimeout(function(){alert('failed');}, 10000);
navigator.geolocation.getCurrentPosition(function(position) {
findInStore.isGeoLocationPos = position;
clearTimeout(location_timeout);
alert('Succ call back')
findInStore.onDirectionLocation(event);
},function(){clearTimeout(location_timeout);
alert('failure call back');});
嘗試
http://stackoverflow.com/questions/7350033/geolocation-not-working-in-safari
http://stackoverflow.com/questions/3397585/navigator-geolocation-getcurrentposition-sometimes-works-sometimes-doesnt
和幾個。但沒有任何幫助。 getCurrentPosition調用失敗。有什麼建議麼?我不擅長這一點。