Skip to content Skip to sidebar Skip to footer

Javascript: Detect When Page Has Been Navigated "back" To

Suppose I have a page open in a browser and I go to my address bar and enter another page. Then I hit the back button to go to my original page. I'd like to write some Javascript c

Solution 1:

You should try to give the user a cookie on both pages, the navigated to page and the page itself, with dates and times and compare see if they're close, or if they show that he's been on one page, been on another, and then redirected.

Another option is to give the user a cookie when he is redirected

Solution 2:

In Firefox, you can check for the DomContentLoaded event. For a cross-browser solution, a little more work is required:

http://dean.edwards.name/weblog/2005/09/busted/

Post a Comment for "Javascript: Detect When Page Has Been Navigated "back" To"