There are already a few similar questions but they tend to cover child-to-parent relationship.
I, on the other hand, would like to be able to get some properties of the IFrame's DOM. I don't want to manipulate anything. I only want to be able to read properties or DOM nodes. Things like attributes or contents.
AFAIK this is not possible unless I use something like window.postMessage
. As reasonable as this solution it's based on event listeners. This requires a listener to be defined inside the IFrame and this means changing the IFrame's code. I want to avoid that.
If you want to make a cross-domain Ajax call, you can (if you have access too) set target server's headers to allow that:
Access-Control-Allow-Headers:X-Requested-With
Access-Control-Allow-Methods:POST,GET,DELETE,PUT,OPTIONS
Access-Control-Allow-Origin:*
This interestingly enough doesn't work for communication with an IFrame. So my question stands:
(How) can I access cross-domain IFrame's DOM properties?