简体   繁体   English

在IE中嵌入谷歌地图

[英]embed google maps in IE

I am trying to do a simple google map embed but it does not work in internet explorer. 我正在尝试做一个简单的谷歌地图嵌入,但它在Internet Explorer中不起作用。 I went to google maps clicked the link button and then copy and pasted the embed code. 我去谷歌地图点击了链接按钮,然后复制并粘贴了嵌入代码。 It is working in all the other browsers. 它适用于所有其他浏览器。 Does anyone know how to make it work in IE? 有谁知道如何让它在IE中工作? I find it hard to believe that google would just make the embed code incompatible. 我发现很难相信谷歌会让嵌入代码不兼容。

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

this is in IE8. 这是在IE8中。 the map works when I switch to compatibility mode. 当我切换到兼容模式时,地图有效。 I don't think the users of the site would even know what compatibility mode is, so I want to figure out how this can work. 我不认为该网站的用户甚至不知道什么是兼容模式,所以我想弄清楚它是如何工作的。

solution is simple: just find the ll parameter in iframe's src... ll is the center position of the map. 解决方案很简单:只需在iframe的src中找到ll参数... ll是地图的中心位置。 So find another coordinate on google map which is a little bit over or below your main marker. 因此,在谷歌地图上找到另一个坐标,该坐标略高于或低于您的主要标记。 copy the new coordinates and change ll on src ... So when you show/hide map, you see your marker is centered, or at least somewhere on the map 复制新坐标并在src上更改ll ...因此,当您显示/隐藏地图时,您会看到您的标记居中,或者至少在地图上的某个位置

This is more of a hack, but I think you can use 这更像是一个黑客,但我认为你可以使用

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

in order to tell IE8 to emulate IE7. 为了告诉IE8模仿IE7。

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

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