与以下问题相关: Unspecified Error from Google Maps API on IE8
在函数中 函数 Mp(a,b){ .. } 以下代码行会触发错误 var e=a.getBoundingClientRect();
- 要复制此错误
- 制作一个 Google map 页面(确保页面足够高,以便有足够的空间滚动页面,不要使 map 全屏显示)
- 放置标记
- 在 IE 中以 Debug模式打开应用(我在 10 中进行了测试)
- 页面加载时,单击标记以显示信息窗口,即弹出窗口
- 尝试滚动页面
You'll get the error.
getBoundingClientRect(),一种返回容器位置的 IE 功能。这些问题可能与工具提示(即信息窗口)有关。
查看更多:http://ejohn.org/blog/getboundingclientrect-is-awesome/
尝试了解决方案:google.maps.event.clearListeners(window, 'resize'); 没用。
Sample App: https://googledrive.com/host/0B-Y3wXhWdoQebnBUV2RNRWhJZE0/test-shell.html Courtesy: @user2250544
最佳答案
如果你喜欢这种事情,这里有一个看起来很有效的肮脏技巧:
HTMLElement.prototype.getBoundingClientRect = (function () {
var oldGetBoundingClientRect = HTMLElement.prototype.getBoundingClientRect;
return function() {
try {
return oldGetBoundingClientRect.apply(this, arguments);
} catch (e) {
return {
left: '',
right: '',
top: '',
bottom: ''
};
}
};
})();
关于google-maps - 在 Google map 中 getBoundingClientRect 在 IE 中给出未指定的错误,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/19275088/