【发布时间】:2014-01-07 13:57:16
【问题描述】:
我想使用 magnific popup 插件在弹出窗口中加载整个 html 页面。如果我尝试:
<a href='/page.html' class='btn' id="edit-images-btn">Edit images</a>
<script>
$('#edit-images-btn').magnificPopup({
type: 'ajax'
});
</script>
它产生这个:
这在图形上是我想要的,但问题是<html></html> 的内容直接插入到 dom 中,而没有放置在保护性 iframe 中。那可不好。我想要华丽的弹出窗口为内容创建一个不可见的 iframe。我在控制台中也遇到了一些奇怪的 js 错误:
Failed to load resource: the server responded with a status of 405 (Method Not Allowed) http://maps.googleapis.com/maps/api/js?key=AIzaSyBW_Py3pNsiSifVJzqL8J28LFCQ6P1KaX0&sensor=false&libraries=places&_=1389102487002
Failed to load resource: No 'Access-Control-Allow-Origin' header is present on the requested resource. Origin 'http://127.0.0.1:8008' is therefore not allowed access. http://maps.googleapis.com/maps/api/js?key=AIzaSyBW_Py3pNsiSifVJzqL8J28LFCQ6P1KaX0&sensor=false&libraries=places&_=1389102487002
XMLHttpRequest cannot load http://maps.googleapis.com/maps/api/js?key=AIzaSyBW_Py3pNsiSifVJzqL8J28LFCQ6P1KaX0&sensor=false&libraries=places&_=1389102487002. No 'Access-Control-Allow-Origin' header is present on the requested resource. Origin 'http://127.0.0.1:8008' is therefore not allowed access.
这些错误可能是由于 html 结构无效或多次包含 google maps api 造成的。不确定。它可能会通过 iframe 内容来解决。
【问题讨论】:
标签: javascript jquery iframe magnific-popup