Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Controling Back Button Functionality in a Framed Page

Status
Not open for further replies.

TheJhereg

Programmer
Nov 12, 2001
31
US
'lo everyone...

I'm building an intranet tool site here at work and have run into a small problem.

One of the content pages is a 2 (top/bottom) frame set. The lower frame is a PHP page that reloads using javascript "onLoad='document.location = "page.php?variable=n"'" about 10 times to update content in the upper frame using .id.innerHTML.

The problem I have is that each reload of the lower frame adds a history and "back" state for each reload. This has strange results if the user clicks the back button, basically overloading the id.innerHTML with the same information for each press of the back button.

What I'm looking for is a method of either altering last history state so that the back button takes them to the portal page in the parent frame, or somehow disallowing the lower frame refresh from adding a back button state.

The site is pretty much IE only, so that might allow a bit more options, if needed.

Any help would be appreciated.

The Jhereg
=~=~=~=~=~=~=~=~=~=~
I never lie.
I'm building a reputation for honesty so I can blow it when something big comes along... This ain't it.
 
I found the answer myself and for any of you interested instead of using:
Code:
onLoad="document.location ='page.php?variable=n'"

use the replace method:
Code:
onLoad="document.location.replace('page.php?variable=n')"
This replaces the current entry in the back and history state, instead of adding a new entry.

go me! LOL The Jhereg
=~=~=~=~=~=~=~=~=~=~
I never lie.
I'm building a reputation for honesty so I can blow it when something big comes along... This ain't it.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top