Skip to content

Instantly share code, notes, and snippets.

@lyonsun
Created December 15, 2014 13:12
Show Gist options
  • Save lyonsun/a82980aad8182e7bab75 to your computer and use it in GitHub Desktop.
Save lyonsun/a82980aad8182e7bab75 to your computer and use it in GitHub Desktop.
force browser to reload page on back button pressed. CREDIT: http://stackoverflow.com/questions/20899274/how-to-refresh-page-on-back-button-click
<input type="hidden" id="refreshed" value="no">
<script type="text/javascript">
onload=function(){
var e=document.getElementById("refreshed");
if(e.value=="no")e.value="yes";
else{e.value="no";location.reload();}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment