Link to home
Start Free TrialLog in
Avatar of johnmemor
johnmemor

asked on

How do I know if user has hit BACK button ?

I have one page, called page1.html.
I visited page1.html first, then I visited another page.
What javascript code can I place in page1.html, so when someone hit BACK
button to go back to page1.html, he/she should see an alert box states that
"you hit BACK" on page1.html ?

p/s : I only want to use javascript, no post or get method.
ASKER CERTIFIED SOLUTION
Avatar of JonFish85
JonFish85

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of johnmemor
johnmemor

ASKER

Can I only use history object, and not cookies ?
No you are not able to see the history, it is a security feature to keep others from knowing the site you just came from, forward or back in the history.

Cookie or server side processing and tracking will need to be set up.
This question has been abandoned. I will make a recommendation to the
moderators on its resolution in a week or two. I appreciate any comments
that would help me to make a recommendation.
<note>
   In the absence of responses, I may recommend DELETE unless it is clear
   to me that it has value as a PAQ.  Silence = you don't care
</note>

Cd&
It is time to clean this abandoned question up.  

I am putting it on a clean up list for CS.

<recommendation>
points to JonFish85

</recommendation>

If anyone participating in the Q disagrees with the recommendation,
please leave a comment for the mods.

Cd&
per recommendation

SpideyMod
Community Support Moderator @Experts Exchange