当我试图访问谷歌地图在lightbox iframe我得到不安全的JavaScript试图访问框架与URL域,协议和端口必须匹配。
我的代码是
<a href="#inline_demo86871" rel="prettyPhoto[inline]" onclick="response_map(86871)"><strong>Map It</strong></a>
这里我使用pretty photo为弹出式灯箱取决于response_map id它加载谷歌地图弹出。
一切都很好,但是。当我试图通过点击锚标记加载地图时,我得到了错误。
Unsafe JavaScript attempt to access frame with URL http://mysite.com from frame with URL http://maps.google.com/maps?f=q&source=s_q&hl=en&geocode=&q=address&output=embed. Domains, protocols and ports must match.
我建议您阅读该教程:http://www.no-margin-for-errors.com/blog/2010/09/28/tutorial-opening-custom-content-in-prettyphoto/
它将帮助您了解如何在pretypto中打开自定义内容(Google Maps)。
希望能有所帮助。
Google禁用了使用iframes访问其网站的能力(参见http://tech.slashdot.org/story/11/10/23/1949227/google-not-reciprocating-on-iframe-usage)