I have seen some elegant solutions on fetching the parents document from iframe - like e.g. this one. However, I can\'t make it work - and I didn\'t think this was possible
It's still possible to access the parent from within a frame provided that the domains match.
For example, have a look at these fiddles:
fiddle.jshell.net
, parent host: fiddle.net
Does not match = failurejsfiddle.net
, parent host: jsfiddle.net
**Matches = success*You can access the parent through:
window.parent
parent
top //If the parent is the top-level document
window.top
The variables parent
and top
can be overwritten (usually not intended). It's safer to use window.parent
to be more safe. Alternatively, you can replace window
by document.defaultView
.