Redirect parent window from an iframe action

Click Upvote picture Click Upvote · Feb 24, 2009 · Viewed 447.9k times · Source

What JavaScript do I need to use to redirect a parent window from an iframe?

I want them to click a hyperlink which, using JavaScript or any other method, would redirect the parent window to a new URL.

Answer

MIP picture MIP · Jul 7, 2010
window.top.location.href = "http://www.example.com"; 

Will redirect the parent iframe.