有关问题: Unspecified Error from Google Maps API on IE8
在功能上 函数Mp(a,b){..} 以下代码行会触发错误 var e = a.getBoundingClientRect();
你会收到错误。
getBoundingClientRect(),一个返回容器位置的IE功能。这些问题可能与工具提示有关,即信息窗口。
仔细看看:http://ejohn.org/blog/getboundingclientrect-is-awesome/
尝试了解决方案:google.maps.event.clearListeners(window,'resize'); 它不起作用。
示例应用:https://googledrive.com/host/0B-Y3wXhWdoQebnBUV2RNRWhJZE0/test-shell.html 礼貌:@ user2250544
答案 0 :(得分:8)
这是一个肮脏的黑客,似乎有用,如果你有这样的事情:
HTMLElement.prototype.getBoundingClientRect = (function () {
var oldGetBoundingClientRect = HTMLElement.prototype.getBoundingClientRect;
return function() {
try {
return oldGetBoundingClientRect.apply(this, arguments);
} catch (e) {
return {
left: '',
right: '',
top: '',
bottom: ''
};
}
};
})();
答案 1 :(得分:2)
我在回发之前通过Despose GMap修复错误:
unction fnGMap_initialize(strFrame) {
var divDealerMap = document.getElementById("divDealerMap");
var mapOptions = {
zoom: 10,
center: new google.maps.LatLng(50, 0),
mapTypeControl: true,
mapTypeId: google.maps.MapTypeId.ROADMAP
}
oGMap = new google.maps.Map(divDealerMap, mapOptions);
Sys.WebForms.PageRequestManager.getInstance().add_beginRequest(oGMap_Dispose);
}
function oGMap_Dispose() {
var divDealerMap = document.getElementById("divDealerMap");
if (divDealerMap) divDealerMap.parentNode.removeChild(divDealerMap);
}
答案 2 :(得分:0)
清除浏览器缓存,如下所述:https://support.google.com/maps/answer/21849?hl=en帮我解决了类似的问题