Javascript parent page redirection from iframe.
Posted
by Danil
on Stack Overflow
See other posts from Stack Overflow
or by Danil
Published on 2010-06-07T14:28:21Z
Indexed on
2010/06/07
14:32 UTC
Read the original article
Hit count: 235
Hello to all.
I need to implement parent page redirection from iframe. I know that it is impossible to do in different domains due to browsers security. However I found that links have target attribute and tried to use it in the following way:
<a href="http://google.com" target="_top" id="testParentRedirect">someLink</a>
It works fine if I click this link manually, but I couldn't find cross-browser solution to simulate it using javascript.
document.getElementById('testParentRedirect').click();
This works fine in IE, however Firefox and Safary don't know click function :).
I tried to work with jquery, but for some reason they don't simulate click event for links. (see following post)
I couldn't find any appropriate solution on stackoverflow. Maybe someone could help me in it. I will appreciate it. :)
© Stack Overflow or respective owner