Google地图API v3无法在IE9中呈现(IE10,Firefox和Chrome可以顺利呈现) [英] Google Maps API v3 doesn't get rendered in IE9 (IE10, Firefox and Chrome render it smoothly)

查看:125
本文介绍了Google地图API v3无法在IE9中呈现(IE10,Firefox和Chrome可以顺利呈现)的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我们正在从Google Map API v2更新到v3,并且至今我已能够实现所有必需的功能。至少在IE,Firefox和Chrome的最新版本方面。我们还得到了API必须在IE9上工作的要求。

相关代码(简化后,我评论了之后跳转到另一个位置并将结果标记出来的代码): p>

  @UiField 
SimplePanel mapWrapper;

[...]
MapOptions选项= 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();

虽然IE10包含

 < 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;>
[...] //构成api及其内容的所有标签
< / div>
< / div>

IE9只有

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

在同一位置。 解决方案

(由OP在一个问题编辑器中回答。转换为社区维基答案。参见没有答案的问题,但在评论中解决的问题(或在聊天中扩展)

OP写道:


确实存在一个JS错误,指出API已多次加载。



删除-.gwt.xml文件中的第一行后,IE9能够加载API并按预期工作。




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




尽管其他浏览器都没有问题,它。



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.

解决方案

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

这篇关于Google地图API v3无法在IE9中呈现(IE10,Firefox和Chrome可以顺利呈现)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆