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!

How to know there is a forward page?

Status
Not open for further replies.

lunnar

Programmer
Jan 11, 2005
2
CA
ok, here is my problem :

I got a page that need to do something different if the page is view after a back button press.

so I need a way to know if there is a next or forward page in the history buffer. anyway to do this in IE 5 ?
 
You cannot find out, with Internet Explorer, if the user has clicked back to view the page. You can, however, make a forward button, or a button which takes you to any point in the open window's history.

 
oh, that's a shame, I knew there was some security with IE, but since I only need to know if there is a forward page available and I don't need the url, I was sure there was a way to know. Because what I need to do, is to run a javascript function only if the page is not loaded after a back(because if not a got a layer that stay open in the middle of my page and should not)

I don't suppose there is any other way to know?

My only remaining solution is to use a cookie but only if I have no other choice.
 
ye, cookies would always work, but it is not too deisrable to use cookies as many peopl do not enable them.

Maybe you could put a seperate back button on the forward page, something like this-
<a href=back.html?afterback>Back</a>

and on the back page do something like this-

<body onload=checkforward()>
<script>
function checkforward() {
var afterback = document.location
afterback = afterback.split("?")
if (afterback[1] == "afterback") {
alert("The user pressed the back button to reach this page")
}
else {
alert("The user did not press the back button to reach here")
}
}
</script>

I'm not to sure about my use of the split() function, and if this is appropriate for your pages, but it's just an idea.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top