Cross-domain access in iframe from child to parent

2020-02-12 02:01发布

问题:

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

I am getting a permission denied error.

回答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



回答2:

This rather old blog post seems to be addressing this issue: 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.

So the permission denied error is correct.