Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Detect if the user has used the back button

My webpage runs a javascript function when the page is loaded. However, I don't want the function to run if the user comes back to this page using the back button. How can I prevent this using javascript?

$(document).ready(function(){
  // Do not run this function if the user has arrived here using the back button  
  RefreshThePage();
});
like image 637
Tom Avatar asked Mar 23 '10 09:03

Tom


1 Answers

I'd have thought that using cookies is the easiest way to do this

like image 95
matpol Avatar answered Sep 23 '22 04:09

matpol