1

我有一张针对不同地方的简短谷歌网址表,例如,

ID|URL
------
1|http://goo.gl/maps/7nps
2|http://goo.gl/maps/wZlPp

取决于 URL 中的参数我需要在浏览器中显示该位置的嵌入式地图。

因此,要嵌入第二张地图,我使用谷歌给我的 iframe html 脚本:

<iframe width="425" height="350" frameborder="0" scrolling="no" marginheight="0" marginwidth="0" src="http://maps.google.com/?ie=UTF8&amp;t=h&amp;ll=40.408791,-3.692586&amp;spn=0.002859,0.00456&amp;z=17&amp;output=embed"></iframe><br /><small><a href="http://maps.google.com/?ie=UTF8&amp;t=h&amp;ll=40.408791,-3.692586&amp;spn=0.002859,0.00456&amp;z=17&amp;source=embed" style="color:#0000FF;text-align:left">View Larger Map</a></small>

它有效,但它使用长网址:http ://maps.google.com/?ie=UTF8&t=h&ll=40.408791,-3.692586&spn=0.002859,0.00456&z=17&output=embed

当我尝试用较短的链接替换它时,它不起作用:

<iframe width="425" height="350" frameborder="0" scrolling="no" marginheight="0" marginwidth="0" src="http://goo.gl/maps/wZlPp"></iframe><br />

怎么可能在那里使用短链接?

4

1 回答 1

1

当您查看开发人员控制台时,您会得到如下信息:

Load denied by X-Frame-Options: https://maps.google.com/?ie=UTF8&ll=48.858151,2.293611&spn=0.00648,0.021973&t=h&z=16 does not permit cross-origin framing.

所以问题是同源策略。在这种情况下,不能使用短链接。

于 2013-04-18T17:01:32.650 回答