无法在谷歌chrome中关闭iframe
Cant close an iframe in google chrome
im使用fancybox插件中的iframe。我可以在每个浏览器中关闭iframe,除了谷歌chrome,使用javascript顺序:
parent.$.fancybox.close();
或:
parent.jQuery.fancybox.close();
只是谷歌铬拒绝在这种情况下做他的工作。
控制台的错误消息是:
不安全的JavaScript尝试访问具有URL的帧file:///C:/Users/exampleuser/Desktop/index.html来自具有URL的帧file:///C:/Users/exampleuser/Desktop/Version42/index.html#.域、协议和端口必须匹配。pidgin.js:357未捕获类型错误:无法读取未定义的属性"fancybox"
如果这很重要的话,我现在的身材是本地的。
尝试使用parent.postMessage()
(此处描述)并侦听父级的window.onmessage
以调用$.fancybox.close()
。
您的代码没有问题,但Google Chrome不允许您在本地使用ajax或iframe(以及fancybox)。您需要将文件上传到服务器才能使其正常工作。
相关文章:
- 在firefox和chrome中的左侧显示iframe滚动条
- 在Chrome中,如何知道document.write何时更改iframe的内容
- 动态(重新)创建iframe内容不会重置Chrome中的JS对象
- Chrome扩展在检测iframe时失败
- Iframe加载调整大小在Chrome中工作,但不能在IE或Firefox中工作
- 在 iFrame 中注入 JS 文件,通过 Google chrome 扩展名中的 ContentScript 进行
- 尝试从我的 chrome 扩展程序访问 gmail 中的 iframe 时出现未定义的错误,但不是从开发者控制台访问
- JavaScript调整iFrame大小-适用于Firefox/IE,但不适用于Chrome
- Iframe如何访问chrome扩展中的父窗口
- 异步表单w/Iframe Target——OnLoad适用于FF、Chrome、IE9,不适用于;无法在IE7中得到响应
- iframe.height(100);正在添加 chrome,并在火狐中设置
- 在Google Chrome中打印iFrame时出现问题
- 如何允许在谷歌chrome中通过触摸屏放大和缩小iframe
- 将IFrame滚动到顶部在Chrome中不起作用
- Chrome扩展-访问iframe元素
- 在 chrome 中获取 iframe 正文 html 内容
- Chrome iframe:window.open 不适用于 onload handler
- 在 Chrome.tabs.onUpdate 侦听器上插入 iframe
- 隐藏iframe chrome回调未触发
- 跨原产地问题与iFrame chrome扩展