繁体   English   中英

在IE中嵌入谷歌地图

[英]embed google maps in IE

我正在尝试做一个简单的谷歌地图嵌入,但它在Internet Explorer中不起作用。 我去谷歌地图点击了链接按钮,然后复制并粘贴了嵌入代码。 它适用于所有其他浏览器。 有谁知道如何让它在IE中工作? 我发现很难相信谷歌会让嵌入代码不兼容。

<iframe width="425" height="350" frameborder="0" scrolling="no" marginheight="0" marginwidth="0" src="http://maps.google.com/maps?f=q&amp;source=s_q&amp;hl=en&amp;geocode=&amp;q=2220+Haine+Drive,+Suite+45+78550&amp;aq=&amp;sll=37.0625,-95.677068&amp;sspn=44.744674,107.138672&amp;ie=UTF8&amp;hq=&amp;hnear=2220+Haine+Dr,+Harlingen,+Cameron,+Texas+78550&amp;view=map&amp;z=14&amp;ll=26.176442,-97.667951&amp;output=embed"></iframe><br /><small><a href="http://maps.google.com/maps?f=q&amp;source=embed&amp;hl=en&amp;geocode=&amp;q=2220+Haine+Drive,+Suite+45+78550&amp;aq=&amp;sll=37.0625,-95.677068&amp;sspn=44.744674,107.138672&amp;ie=UTF8&amp;hq=&amp;hnear=2220+Haine+Dr,+Harlingen,+Cameron,+Texas+78550&amp;view=map&amp;z=14&amp;ll=26.176442,-97.667951" style="color:#0000FF;text-align:left">View Larger Map</a></small>

这是在IE8中。 当我切换到兼容模式时,地图有效。 我不认为该网站的用户甚至不知道什么是兼容模式,所以我想弄清楚它是如何工作的。

解决方案很简单:只需在iframe的src中找到ll参数... ll是地图的中心位置。 因此,在谷歌地图上找到另一个坐标,该坐标略高于或低于您的主要标记。 复制新坐标并在src上更改ll ...因此,当您显示/隐藏地图时,您会看到您的标记居中,或者至少在地图上的某个位置

这更像是一个黑客,但我认为你可以使用

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

为了告诉IE8模仿IE7。

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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