本文介绍了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写道:
< script src =http://maps.google.com/maps/api/js?sensor=false/ >
< script src =http://maps.google.com/maps/api/js?sensor=false&v=3&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:
<script src="http://maps.google.com/maps/api/js?sensor=false" />
<script src="http://maps.google.com/maps/api/js?sensor=false&v=3&libraries=geometry" />
这篇关于Google地图API v3无法在IE9中呈现(IE10,Firefox和Chrome可以顺利呈现)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!