0

Is it possible to not re-execute javascript code when the user comes back to the page clicking the back button ? But normally execute it when the user opens the page or refresh it.

I mean some code on the bottom of the page: ..., not in a 'onload' function. No jquery and no libraries, thanks.

Jackt
  • 171
  • 1
  • 1
  • 15
  • 1
    Yes, this is probably possible, but [what is your actual problem](http://meta.stackexchange.com/q/66377)? – Bergi Jul 19 '16 at 22:29
  • Save some information to a cookie or local storage when they press "back" then only run some code if that isn't set. – Mike Cluck Jul 19 '16 at 22:29
  • Take a look at the [History API](https://developer.mozilla.org/en-US/docs/Web/API/History_API). It has the cabaility to do what you need – bren Jul 19 '16 at 22:29
  • Mike, that question/answer is extreamly complicated, but the idea of the cookie is not bad... – Jackt Jul 19 '16 at 22:49

0 Answers0