简体   繁体   中英

Google Maps API v3.19 Broken in Internet Explorer Quirks Mode

Version 3.19 of the Google Maps API became the default maps 'release' on the 17th Feb 2015 (See https://code.google.com/p/gmaps-api-issues/wiki/JavascriptMapsAPIv3Changelog ). The release appears to be causing issues in Internet Explorer when using quirks mode , as is demonstrated by the following test page that I produced from an application which is affected by this issue (and so this may include more code than is necessary here):

<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>

Both Firefox and Chrome will properly show a useable map, while IE raises an error deep in the Google Maps code which reads 'Could not get the display property. Invalid argument.' I've tried debugging the code but it is obfuscated, making it a painful challenge.

Forcing the version back to the last 'frozen' release (3.18) fixes the issue for the time being, but this is only a temporary resolution.

Can anyone suggest a resolution other than report this to Google and hope they fix it?


Additional note:

As I write I note that the information here https://code.google.com/p/gmaps-api-issues/wiki/JavascriptMapsAPIv3Changelog says the releases are:

Experimental: 3.20
Release: 3.19
Frozen: 3.18 

Version 3.17 will be removed. Requests for 3.17 or any prior version will now be served version 3.18'

While this page https://developers.google.com/maps/documentation/javascript/basics#Versioning says (at the bottom of the page):

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

This is rather confusing but I would think the Changelog link to be the more up to date source of information. This difference confused me so I thought it worth sharing the observation.


Update 20-Feb-15:

Yesterday Google confirmed this as a Bug - see https://code.google.com/p/gmaps-api-issues/issues/detail?id=7675 - and advised 'We're looking into a fix.'

Thanks for the comments and suggestions, but so far I haven't been able to find a work around which allows my application to work fully as other page components depend on quirks mode, creating a good deal of work to get the whole thing working again. I'm hopeful that Google's attention will resolve this for me.


Update 21-Feb-15:

https://code.google.com/p/gmaps-api-issues/issues/detail?id=7675 now indicates 'A fix will be deployed in the coming week.'

Found the same issue today with a web app I've just inherited. For some reason the previous devs were forcing IE into quirks (ie7) mode and the google api issue started today. I've updated the main html page to use IE edge mode by changing the html head section from

<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" /> 
 .....

to

<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" /> 
.....

(if you are missing it add the ie-edge meta... line)

and its fixed it so far.

Now to find out why the previous devs were forcing IE7 mode....

SOLVED: Had same problem with IE8 (XP), IE9 (Win7) and compatibility mode in Win 7 and XP. I added the version number and voila! Fixed.

http://maps.googleapis.com/maps/api/js ?v=3 &key=...

Specifying v=3 forces the stable release. My old code without this version flag was interpreted by Google as I wanted the experimental version which I never want for my production server.

FYI, I use <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">

We are using the GMLib Google Maps delphi component and we had the same problem. The GMLib component uses the TWebBrowser component inside.

Within the resource files of the GMLib component we found a map.html file. We added the following line to the section of the html file.

<meta http-equiv="X-UA-Compatible" content="IE=edge" />

We then recompiled the resource files into the component, recompiled the delphi project and it worked.

I suppose this is one of the downsides of using relatively unsupported free components.

We are now considering moving to a commercial paid for google maps component to reduce the risk of this happening again.

在我的情况下(.net 4 visual c#与webbrowser集成)来修复这个问题我只是添加&v = 3似乎如果你没有指定版本它将使用实验的...奇怪。

I have an application in Delphi using TWebBroser, this was the temporary solution that I found, but is not 100% because to solve this I had to add a Key on Windows, using regedit. Forcing IE to emulate in the version informed on the Key I created, for better understanding look at the item Browser Emulation inside this link https://msdn.microsoft.com/en-us/library/ee330730(v=vs.85).aspx . This solution only works if the IE version stated in the Key is installed.

We also faced the same issue in a C# program using the standard .net WebBrowser control.

We also solved the problem by adding the line

<meta http-equiv="X-UA-Compatible" content="IE=edge" />

Note that it didn't work on a Vista configuration with Internet Explorer 7, but it was OK after installation of IE 9 ( more than 3 hours for installing Service pack1, service pack 2, 2 microsoft corrective patches and finally IE9 itself ).

I'm glad to say that Google responded to this issue in a very positive way; they quickly categorised it as a bug, advised they were working on it and today I'm testing again and see that the 'quirks' issue is no more and my application is again behaving.

The question I asked was 'Can anyone suggest a resolution other than report this to Google and hope they fix it?'. The application where I saw this issue is (evidently) heavily dependent on quirks mode and so I saw a number of issues with other components on the page when trying to remove that dependency - ie the issue became much bigger. Hence Google fixing this issue was indeed the only answer which really worked for me and I'm glad that they did.

Thanks for everyone's help and contribution.

In my case, IE 11 not response with Google Maps .... My solution is: point one:

Add header :

Point two:

Add JS V3:

Regards

This works fine

< script src="https://maps.googleapis.com/maps/api/js&v=3.18" type="text/javascript"></script>

This don't

< script type="text/javascript" src="https://maps.googleapis.com/maps/api/js&v=3.18"</script>

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM