top.frames[0].history.back() causing wrong frame to navigate backwards

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • Justin

    top.frames[0].history.back() causing wrong frame to navigate backwards

    Hi,

    I have a simple frameset defined:

    ---------------- index.html ----------------

    <FRAMESET COLS = "225,*">
    <FRAME NAME = "a" SRC = "one.html">
    <FRAME NAME = "b" SRC = "one.html">
    </FRAMESET>
    ------------------------------------------------

    And two pages:

    ---------------- one.html ----------------

    <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Frameset//EN"
    "http://www.w3.org/TR/html4/frameset.dtd">
    <HTML>
    <HEAD>
    <TITLE>One</TITLE>
    </HEAD>
    <BODY>
    <b>one</b>
    <br/>
    <a href="two.html" >next</a>
    </BODY>
    </HTML>

    ---------------- two.html ----------------

    <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Frameset//EN"
    "http://www.w3.org/TR/html4/frameset.dtd">
    <HTML>
    <HEAD>
    <script language="JavaS cript">
    function doBack() {
    var backFrame = top.frames[0];
    backFrame.histo ry.back();
    }
    </script>

    <TITLE>One</TITLE>
    </HEAD>
    <BODY>
    <b>two</b>
    <br/>
    <a href="javascrip t:doBack();">ba ck</a><br/>

    </BODY>
    </HTML>

    ------------------------------------------------

    When I do the following:

    Click 'next' in the first frame.
    Click 'next' in the second frame.
    Click 'back' in the first frame.

    ..... the frame that is moved back is the second frame (last one that I
    navigated with) and NOT the first as expected.
    From what I can gather from the manuals/references, the code:
    top.frames[0].history.back() ;
    should ONLY affect the first (zero index) frame. Why is it affecting
    the other frame?
    There doesn't seem to be a per frame history, but rather a global
    history and the frame specifier is ignored.

    How do I reliably navigate back on a per frame basis?


    This behaviour is the same on IE6 and Firefox 0.91.

    Thanks
  • Steve van Dongen

    #2
    Re: top.frames[0].history.back() causing wrong frame to navigate backwards

    walshj@isiscpt. co.za (Justin) wrote:
    [color=blue]
    >Hi,
    >
    >I have a simple frameset defined:
    >[/color]
    <snip />[color=blue]
    >
    >When I do the following:
    >
    >Click 'next' in the first frame.
    >Click 'next' in the second frame.
    >Click 'back' in the first frame.
    >
    >.... the frame that is moved back is the second frame (last one that I
    >navigated with) and NOT the first as expected.
    >From what I can gather from the manuals/references, the code:
    >top.frames[0].history.back() ;
    >should ONLY affect the first (zero index) frame. Why is it affecting
    >the other frame?
    >There doesn't seem to be a per frame history, but rather a global
    >history and the frame specifier is ignored.[/color]

    That seems to be the logical conclusion.
    <URL:
    Find official documentation, practical know-how, and expert guidance for builders working and troubleshooting in Microsoft products.

    />
    states that the back() method performs the same action as a user
    clicking the Back button in the browser. The browser -- IE anyways --
    only has one history.

    Regards,
    Steve

    Comment

    Working...