問候大家, 我正在創建一個使用Geolocation API定位最終用戶的Web應用程序。除了Internet Explorer 9以外,它幾乎可以在任何我能想到的平臺上運行。儘管如此,事情會變得有點陌生。如果我已將我的Google工具欄加載到Internet Explorer瀏覽器窗口中,則所有內容都可以順暢地運行。這是問題的代碼塊,我一直努力着:ie9不支持地理定位?
if (navigator.geolocation) {
var locationMarker = null;
navigator.geolocation.watchPosition(
function(position){
var point = new google.maps.LatLng(position.coords.latitude, position.coords.longitude);
if (!locationMarker) {
locationMarker = addMarker(
position.coords.latitude,
position.coords.longitude,
"Initial Position"
);
}
else{
updateMarker(
locationMarker,
position.coords.latitude,
position.coords.longitude,
"Updated/Accurate Position"
);
};
map.setCenter(point);
if (map.zoom < 17){
map.setZoom(17);
};
},
function(error){
console.log("Something went wrong: ", error);
},
{
timeout: (5 * 1000),
maximumAge: (1000 * 60 * 15),
enableHighAccuracy: true
}
);
}
else {
alert("Geolocation is not supported by this browser");
}
每當我使用Internet Explorer 9訪問我的應用程序得到警報「地理位置是此瀏覽器不支持」。除非我的Google工具欄處於活動狀態。如果Google工具欄處於活動狀態,則Google工具欄會處理這些權限。
如何獲得地理位置在IE9中的工作?我的應用程序在Safari,Firefox,Chrome,iOS和Android上完美運行。我完全難住。
感謝,泰勒華林
奇妙。 thx夥計。 – albert