Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 8 of 8
  1. #1
    Regular Coder
    Join Date
    Nov 2002
    Posts
    161
    Thanks
    2
    Thanked 0 Times in 0 Posts

    Iframes and the Back Button

    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

  • #2
    Banned
    Join Date
    Sep 2003
    Posts
    3,620
    Thanks
    0
    Thanked 0 Times in 0 Posts
    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.

    .....Willy

  • #3
    Regular Coder
    Join Date
    Nov 2002
    Posts
    161
    Thanks
    2
    Thanked 0 Times in 0 Posts
    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

  • #4
    Banned
    Join Date
    Sep 2003
    Posts
    3,620
    Thanks
    0
    Thanked 0 Times in 0 Posts
    Without a link or any codes.
    What can I say other than you need to
    target the iframe and replace the source.

    .....Willy

  • #5
    Supreme Master coder! glenngv's Avatar
    Join Date
    Jun 2002
    Location
    Philippines
    Posts
    11,032
    Thanks
    0
    Thanked 248 Times in 245 Posts
    top.frames['iframename'].location.replace('page.htm')

    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.

  • #6
    Regular Coder
    Join Date
    Nov 2002
    Posts
    161
    Thanks
    2
    Thanked 0 Times in 0 Posts
    Now working thanks for your help.

  • #7
    New to the CF scene
    Join Date
    Jun 2004
    Posts
    6
    Thanks
    0
    Thanked 0 Times in 0 Posts
    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;
    }

    // -->

    and
    <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

  • #8
    Supreme Master coder! glenngv's Avatar
    Join Date
    Jun 2002
    Location
    Philippines
    Posts
    11,032
    Thanks
    0
    Thanked 248 Times in 245 Posts
    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)" />


  •  

    Posting Permissions

    • You may not post new threads
    • You may not post replies
    • You may not post attachments
    • You may not edit your posts
    •