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.
This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
By continuing to use this site, you are consenting to our use of cookies.