javascript - Google Maps API v3.19 在 Internet Explorer Quirks 模式下损坏

标签 javascript google-maps

Google Maps API 3.19 版于 2015 年 2 月 17 日成为默认 map “发布”(参见 https://code.google.com/p/gmaps-api-issues/wiki/JavascriptMapsAPIv3Changelog)。使用 quirks mode 时,该版本似乎会导致 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>

Firefox 和 Chrome 都可以正确显示可用的 map ,而 IE 会在 Google map 代码深处引发错误,显示为“无法获取显示属性”。无效的论点。'我试过调试代码,但它被混淆了,这使它成为一个痛苦的挑战。

强制将版本恢复为上一个“卡住”版本 (3.18) 可暂时解决此问题,但这只是临时解决方案。

除了向 Google 报告此问题并希望他们修复它之外,还有谁能提出解决方案吗?


补充说明:

在撰写本文时,我注意到此处的信息 https://code.google.com/p/gmaps-api-issues/wiki/JavascriptMapsAPIv3Changelog说发布是:

Experimental: 3.20
Release: 3.19
Frozen: 3.18 

3.17 版将被删除。对 3.17 或任何更早版本的请求现在将以 3.18 版本提供服务'

虽然此页https://developers.google.com/maps/documentation/javascript/basics#Versioning说(在页面底部):

Version 3.18 Reference (Release)
Version 3.19 Reference (Experimental)
Version 3.17 Reference (Frozen)
Versions 3.0 - 3.16 have been retired.

这相当令人困惑,但我认为 Changelog 链接是最新的信息来源。这种差异让我感到困惑,所以我认为值得分享我的观察结果。


20-Feb-15 更新:

昨天 Google 确认这是一个错误 - 请参阅 https://code.google.com/p/gmaps-api-issues/issues/detail?id=7675 - 并建议“我们正在研究解决方案。”

感谢您的评论和建议,但到目前为止,我还没有找到一个解决方法来让我的应用程序完全工作,因为其他页面组件依赖于 quirks 模式,需要做大量的工作才能获得整体事情再次运作。我希望 Google 的关注能为我解决这个问题。


21-Feb-15 更新:

https://code.google.com/p/gmaps-api-issues/issues/detail?id=7675现在表示“将在下周部署修复程序。”

最佳答案

今天在我刚刚继承的网络应用程序中发现了同样的问题。出于某种原因,以前的开发人员迫使 IE 进入怪癖 (ie7) 模式,而 google api 问题从今天开始。我已经通过更改 html head 部分来更新主 html 页面以使用 IE 边缘模式

<html xmlns="http://www.w3.org/1999/xhtml" xmlns:v="urn:schemas-microsoft-com:vml">
 <head>
    <meta http-equiv="X-UA-Compatible" content="IE=7" /> 
 .....

<html xmlns="http://www.w3.org/1999/xhtml" xmlns:v="urn:schemas-microsoft-com:vml">
 <head>
    <meta http-equiv="X-UA-Compatible" content="IE=edge" /> 
.....

(如果您遗漏了它,请添加 ie-edge meta... 行)

到目前为止它已修复。

现在找出为什么以前的开发者强制使用 IE7 模式....

关于javascript - Google Maps API v3.19 在 Internet Explorer Quirks 模式下损坏,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/28587238/

相关文章:

android - 在 Android 中使用 map

python - 请求多值参数的url编码

android - Google Directions API 限制

google-maps - Flutter FutureBuilder 与 Google map 插件和自定义图标一起使用会使屏幕在启动时变黑

javascript - 堆叠模式在关闭时滚动主页

javascript - 带有css的圆形显示动画

javascript - 如何从 JavaScript 检查 session 是否存在

Android Google Maps v2 - 调试键与发布键

javascript - 未处理的拒绝错误 : Integer is unsafe

javascript - 在行中布局 div,然后在列中