Javascript back button for iframe parent window

Posted by DisgruntledGoat on Stack Overflow See other posts from Stack Overflow or by DisgruntledGoat
Published on 2010-06-07T21:17:13Z Indexed on 2010/06/07 21:22 UTC
Read the original article Hit count: 364

Filed under:
|
|

I have some pages with iframes in them. I want to add a link/button inside the iframe, to make the browser go back one page in history. But I want the PARENT to go back, not the iframe itself.

I originally had this, which makes the iframe page go back (if it exists):

<a href="javascript:history.back()">&laquo; Go back</a>

I've tried window.parent.history.back() and window.parent.document.history.back() but neither one works. There are no cross-domain issues accessing the iframe from the parent and vice-versa.

© Stack Overflow or respective owner

Related posts about JavaScript

Related posts about iframe