Link to home
Start Free TrialLog in
Avatar of Tom Knowlton
Tom KnowltonFlag for United States of America

asked on

Detect when user clicks the Back button

How do I do this in JavaScript?

It is not my intent to disable or interefere with this process.  In fact, it needs to work -- I just need to know when it happens is all.

Solution must work in IE and Mozilla, minimum.

Thanks!
ASKER CERTIFIED SOLUTION
Avatar of Tomarse111
Tomarse111
Flag of United Kingdom of Great Britain and Northern Ireland image

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 Tom Knowlton

ASKER

What about hooking into IE or Mozilla?  Don't these browsers expose an API to javascript?
SOLUTION
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
As far as i'm aware you cannot Hook into IE or FF to control or detect the back button natively through JS. The cookie method i think is your best bet (although not perfect) but one of the experts might tell you differently :)
What about using Sessions?

Not to detect a back click, but to record where I  just was, and when I click the back button, where I am coming from to return to the last page I was on.