可以将文章内容翻译成中文,广告屏蔽插件可能会导致该功能失效(如失效,请关闭广告屏蔽插件后再试):
问题:
Relating to question in: Unspecified Error from Google Maps API on IE8
In function function Mp(a,b){ .. } the following line of code triggers an error var e=a.getBoundingClientRect();
- To replicate this error
- Make a Google Map page (make sure it is tall enough that you've spare space to scroll the page, don't make the map full-screen)
- Place a Marker
- Open the app in IE ( I tested in 10) in debug mode
- When page loads, click on a marker such that it shows the info-window i.e. the pop-over
- Try scrolling the page
You'll get the error.
getBoundingClientRect(), an IE feature which returns positions of containers. The issues may be related to tool-tips i.e. info-windows.
Look more at : http://ejohn.org/blog/getboundingclientrect-is-awesome/
Tried the solution: google.maps.event.clearListeners(window, 'resize'); It din't work.
Sample App: https://googledrive.com/host/0B-Y3wXhWdoQebnBUV2RNRWhJZE0/test-shell.html Courtesy: @user2250544
回答1:
Here's a filthy hack that seems to work, if you're into that kinda thing:
HTMLElement.prototype.getBoundingClientRect = (function () { var oldGetBoundingClientRect = HTMLElement.prototype.getBoundingClientRect; return function() { try { return oldGetBoundingClientRect.apply(this, arguments); } catch (e) { return { left: '', right: '', top: '', bottom: '' }; } }; })();
回答2:
I fix the error by Despose GMap before postback:
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); }
回答3:
Clearing the browser cache as mentioned here: https://support.google.com/maps/answer/21849?hl=en helped me to fix similar issues