Google Maps: a simple application does not work in IE

We have a simple Google Maps app for traffic: http://www.avonandsomerset.police.uk/newsroom/traffic/

For some reason, it recently stopped working in IE correctly. At the moment, he used the V2 API, so I just updated it to use V3, but it still won’t work in IE.

It works great in Chrome and Firefox . But in all versions of IE I'm tired (6,7,8), Google Map does not load completely.

Problem
A Google DIV map usually loads all controls (Zoom, Powered by Google, map types), but the actual map fragments do not appear in IE. I can just see the gray background div>

What I tried
I only commented on the JavaScript code on the page, but it still has the same problem:

<script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.4.2/jquery.min.js"></script> 
<script type="text/javascript" src="http://maps.google.com/maps/api/js?sensor=false"></script> 

<script type="text/javascript" > 

    var map;

    $(document).ready(function () {
        initialize(); // Set-up Google map        
    });

    function initialize() {
        var options = {
            zoom: 9,
            center: new google.maps.LatLng(51.335759, -2.870178),
            mapTypeId: google.maps.MapTypeId.ROADMAP
        };
        map = new google.maps.Map(document.getElementById("googleMap"), options);
    }

</script>
+3
source share
3 answers

I finally tracked the issue.

Turns out someone else included sleight.js script () on our main page.

This JavaScript is designed to get PNG transparency working in IE5.5 +, however a defeat affects the fact that it stops Google Maps.

+1
source

I'm going all the way from memory here, but try pasting varright before you grease the Map object and delete it var mapat the top. So:

var map = new google.maps.Map...

, IE / , .. .

+1

I'm not sure, but it could be the difference between browsers in raising features. Try declaring an initialization function before the document ready block.

0
source

Source: https://habr.com/ru/post/1743159/


All Articles