Writing from iframe to an external web page

HI, I have an iframe on my website and I need to write something in a div outside the iframe when the button is clicked, this does not work with the usual

$('#id').html("write something"); 

any ideas how to do this? Many thanks

+7
source share
2 answers
 $('#id', window.parent.document).html('write something'); 

Obviously, this assumes that the parent and iframe are in the same domain, otherwise you will not be able to manipulate the parent from the child, nor the parent will be able to manipulate the child (if they are not from the same family :-))

+23
source

As Darin said, the following will work if the iframe uses the same domain as the parent page:

  $('#id', window.parent.document).html('write something'); 

If the parent domain is different from the child domain, you can use something like this: easyXDM

0
source

All Articles