IE iFrame 权限被拒绝
我在 A.com 上有一个网站,在 B.com 上有一个 iframe,它从 A.com 调用 javascript。这在 FF 中效果很好。在 IE7 / 8 中我收到一条
Message: Access is denied.
消息。我已经通过 Fiddler 检查了 HTTP 流量 - 我可以看到它在 Fiddler 中没有被阻止?
有什么想法可能导致此问题以及如何解决吗?
I have a site on A.com and an iframe on B.com which calls javascript from A.com. This works great in FF. In IE7 / 8 I am getting a
Message: Access is denied.
message. I have checked the HTTP Traffic via Fiddler - and I can see that it isn't blocked in Fiddler ?
Any ideas what could be causing this and how to solve?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
如果这两个页面都在您的控制之下(即它们属于您并且您可以更改代码),请尝试此操作 -
http://www.tomhoppe.com/index.php/2008/03/cross-sub-domain-javascript-ajax-iframe- etc/
设置 document.domain 像这样:
If both the pages are under your control (i.e. they belong to you and you cn alter the code), try this -
http://www.tomhoppe.com/index.php/2008/03/cross-sub-domain-javascript-ajax-iframe-etc/
Set document.domain like this:
只要 IFrame 是“同源”的,即相同的域和相同的协议,它们就可以进行通信。如果它们来源不同,通信就会被阻止。
HTML5引入了一种新的通信机制。可能值得一看 http://www.w3.org/TR/webmessaging/
http://en.wikipedia.org/wiki/Cross-document_messaging
这也是值得的阅读安全隐患
https://www.owasp.org/index.php/HTML5_Security_Cheat_Sheet #Web_Messaging
IFrames can communicate as long as they are "of the same origin" - so same domain and same protocol. Communication is blocked if they are of different origin.
HTML5 introduces a new communication mechanism. It may be worth looking at http://www.w3.org/TR/webmessaging/
http://en.wikipedia.org/wiki/Cross-document_messaging
It is also worth reading up on the security implications
https://www.owasp.org/index.php/HTML5_Security_Cheat_Sheet#Web_Messaging