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

J

Justin

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="JavaScript">
function doBack() {
var backFrame = top.frames[0];
backFrame.history.back();
}
</script>

<TITLE>One</TITLE>
</HEAD>
<BODY>
<b>two</b>
<br/>
<a href="javascript:doBack();">back</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
 
S

Steve van Dongen

Hi,

I have a simple frameset defined:
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.

That seems to be the logical conclusion.
<URL:
http://msdn.microsoft.com/workshop/author/dhtml/reference/methods/back.asp
/>
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
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,769
Messages
2,569,579
Members
45,053
Latest member
BrodieSola

Latest Threads

Top