iframe中从子级到父级的跨域访问

时间:2022-08-23 10:15:36

How do we access parent document from a document loaded inside an iframe when the page loaded inside iframe is from another domain?

当iframe中加载的页面来自另一个域时,我们如何从iframe中加载的文档中访问父文档?

I am getting a permission denied error.

我收到权限被拒绝错误。

2 个解决方案

#1


if you have control of both documents, then you could easily use easyXDM (http://easyxdm.net) to communicate between them. A nice and easy example of using it can be found at http://consumer.easyxdm.net/current/example/methods.html

如果您可以控制这两个文档,那么您可以轻松使用easyXDM(http://easyxdm.net)在它们之间进行通信。可以在http://consumer.easyxdm.net/current/example/methods.html找到使用它的一个简单易用的例子。

#2


This rather old blog post seems to be addressing this issue: http://jszen.blogspot.com/2005/03/cross-domain-security-woes.html

这个相当古老的博客文章似乎正在解决这个问题:http://jszen.blogspot.com/2005/03/cross-domain-security-woes.html

http://radio.javaranch.com/pascarello/2005/12/30/1135962460818.html highlights some of the risk if cross-domain javascript was allowed.

http://radio.javaranch.com/pascarello/2005/12/30/1135962460818.html强调了允许跨域JavaScript的一些风险。

So the permission denied error is correct.

所以权限被拒绝错误是正确的。

#1


if you have control of both documents, then you could easily use easyXDM (http://easyxdm.net) to communicate between them. A nice and easy example of using it can be found at http://consumer.easyxdm.net/current/example/methods.html

如果您可以控制这两个文档,那么您可以轻松使用easyXDM(http://easyxdm.net)在它们之间进行通信。可以在http://consumer.easyxdm.net/current/example/methods.html找到使用它的一个简单易用的例子。

#2


This rather old blog post seems to be addressing this issue: http://jszen.blogspot.com/2005/03/cross-domain-security-woes.html

这个相当古老的博客文章似乎正在解决这个问题:http://jszen.blogspot.com/2005/03/cross-domain-security-woes.html

http://radio.javaranch.com/pascarello/2005/12/30/1135962460818.html highlights some of the risk if cross-domain javascript was allowed.

http://radio.javaranch.com/pascarello/2005/12/30/1135962460818.html强调了允许跨域JavaScript的一些风险。

So the permission denied error is correct.

所以权限被拒绝错误是正确的。