2015年2月17日,Google Maps API 3.19版成为默认地图"发布"(请参阅https://code.google.com/p/gmaps-api-issues/wiki/JavascriptMapsAPIv3Changelog).在使用怪癖模式时,该版本似乎在Internet Explorer中引起问题,正如我从受此问题影响的应用程序生成的以下测试页所证明的那样(因此这可能包含的代码多于此处所需的代码):
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<title>Google Maps Test Page</title>
</head>
<body style="margin:0; padding:0">
<!-- Adding ?v=3.18 onto the end of this URL will 'fix' the problem -->
<script src='http://maps.googleapis.com/maps/api/js' type='text/javascript'></script>
<script type='text/javascript'>
function initialize() {
top.google.maps.visualRefresh=true;
var mapOptions = {
zoom: 13,
center: new google.maps.LatLng(51.5072, 0.1275),
mapTypeId: google.maps.MapTypeId.ROADMAP,
scaleControl: true,
overviewMapControl: true
};
this._map = new google.maps.Map(document.getElementById('myMap'), mapOptions);
}
google.maps.event.addDomListener(window, 'load', initialize);
</script>
<div id="myMap" style="width:500px;height:500px;position:relative;"></div>
</body>
</html>
Run Code Online (Sandbox Code Playgroud)
Firefox和Chrome都会正确显示可用的地图,而IE会在Google地图代码中引发错误,该错误显示"无法获取显示属性".无效的论点.' 我已经尝试调试代码,但它被混淆了,这使它成为一个痛苦的挑战.
强制版本回到最后一个"冻结"版本(3.18)暂时解决了问题,但这只是一个临时解决方案.
任何人都可以提出一个解决方案,而不是向谷歌报告,并希望他们解决它?
附加说明: …