Google Maps API v3 doesn't get rendered in IE9 (IE10, Firefox and Chrome render it smoothly)

痴心易碎 提交于 2019-12-08 12:20:39

问题


We're updating from Google Map API v2 to v3 and I've been able to implement all required functions so far. At least in regard to the newest versions of IE, Firefox and Chrome. We've but also got the requirement that the API has to work on IE9. Sadly it doesn't even appear there.

Related Code (simplified, I commented the code which afterwards jumps to another location and places markers out for the results):

@UiField
SimplePanel mapWrapper;

[...]
MapOptions options = MapOptions.create();
options.setCenter(LatLng.create(46.81819, 8.22751));
options.setZoom(5);
options.setMapTypeId(MapTypeId.ROADMAP);
options.setDraggable(true);
options.setMapTypeControl(true);
options.setPanControl(true);
options.setScaleControl(true);
options.setScrollwheel(true);
options.setStreetViewControl(true);
mapWrapper.setSize("350px", "350px");
m_Map = GoogleMap.create(mapWrapper.getElement(), options);
m_Map.triggerCenterChanged();
m_Map.triggerResize();

While IE10 contains

<div style="width: 350px; height: 350px; overflow: hidden; position: relative; background-color: rgb(229, 227, 223);">
    <div style="left: 0px; top: 0px; width: 100%; height: 100%; overflow: hidden; position: absolute; z-index: 0;">
        [...] // all the tags which make up the api and its content
    </div>
</div>

IE9 has only

<div style="width: 350px; height: 350px;">
    <div style="overflow: hidden;">
    </div>
</div>

at the same location.


回答1:


(Answered by the OP in a question edit. Converted to a community wiki answer. See Question with no answers, but issue solved in the comments (or extended in chat) )

The OP wrote:

There was indeed a JS error which pointed out that the API was loaded multiple times.

After removing the first of the following lines in the -.gwt.xml file, IE9 was able to load the API and works as intended.

<script src="http://maps.google.com/maps/api/js?sensor=false" />
<script src="http://maps.google.com/maps/api/js?sensor=false&amp;v=3&amp;libraries=geometry" />

It baffles me though that neither of the other browsers had a problem with it.



来源:https://stackoverflow.com/questions/19842507/google-maps-api-v3-doesnt-get-rendered-in-ie9-ie10-firefox-and-chrome-render

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!