views:

3348

answers:

3

Hi,

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.

Thanks in advance for the help.

+2  A: 

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.

Douglas Leeder
A: 

If you need only one-way communication from the inner content to the parent, then try this example (method 2) in which the author sets up another iframe inside the first, loading a page at the original domain.

Leon van der Walt
+3  A: 

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/example/methods.html

Sean Kinsey