2

Is there a way to detect in Javascript/jQuery if a previously visited page was loaded again (probably from cache) via the back button of the browser?

I don't want to intercept the back button click event. I simply want to detect if the page was reloaded with a back button click.

PeterInvincible
  • 2,050
  • 5
  • 29
  • 59
  • Did you check [this](http://stackoverflow.com/questions/25806608/how-to-detect-browser-back-button-event-cross-browser). – Shubham Jan 20 '17 at 08:54
  • You can disable client side cache with appropriate http headers. Look for the answers [here](http://stackoverflow.com/questions/49547/how-to-control-web-page-caching-across-all-browsers) – Thangadurai Jan 20 '17 at 08:55
  • two questions in one! – Swift - Friday Pie Jan 20 '17 at 08:56
  • how about restrict user to go to previous page? – claudios Jan 20 '17 at 08:59
  • Thanks for the linked questions, I'll go through them. @claudios, I don't want to restrict the user in any way. – PeterInvincible Jan 20 '17 at 09:10
  • Possible duplicate of [Intercepting call to the back button in my AJAX application: I don't want it to do anything!](http://stackoverflow.com/questions/1844491/intercepting-call-to-the-back-button-in-my-ajax-application-i-dont-want-it-to) – Jay Jan 20 '17 at 09:14
  • 1
    @Jay Not a duplicate. I don't want to intercept anything - – PeterInvincible Jan 20 '17 at 09:17
  • Maybe you can use the localStorage. When you press the "Back Button" add an Item to the LocalStorage and get the item at the start of your page. Only works with same domain, no CORS! – DomeTune Jan 20 '17 at 09:43

0 Answers0