View Full Version : Iframes and the Back Button

02-01-2004, 04:06 PM
I am developing a site with iframes, when you click back the page in the iframe goes back to the previous page displayed in it, rather than this happening I want the page in the main window to go back (the way the back button was intended to work in browser's) is there any way to accomplish this?

Iframes are handy, but this problem is tending to put me off using them :mad:

Willy Duitt
02-01-2004, 05:50 PM
Try using location.replace() on the links which are targetted to appear in the iframe. This should prevent them from appearing in the history of the browser.


02-02-2004, 12:04 AM
So how do I load a page into the iframe with a link from the main page using location.replace() it justs takes over the whole window when I try it:(

Willy Duitt
02-02-2004, 12:26 AM
Without a link or any codes.
What can I say other than you need to
target the iframe and replace the source.


02-02-2004, 04:08 AM

But that would also require all the links in iframe pages to have that location.replace thing so that the pages won't go to the history.

02-02-2004, 06:51 PM
Now working thanks for your help.

06-01-2004, 04:10 PM
hi all,

hmm im using multiple iframes with the following double links method applied:

function linkFrames(u2, u1) {
parent.subnav.location = u1;
parent.content.location = u2;

// -->

<a href="javascript:linkFrames('services.html', 'servmenu.html');">blah</a>

is there a way to apply this to my code so that the back button will go back in both frames? because at the moment it only goes back in one frame!

thanks:) :thumbsup:

06-02-2004, 08:34 AM
No, you can only go back one page at a time, unless you create your own [Back] button.

<input type="button" value="Back 2 pages" onclick="history.go(-2)" />