<input type="hidden" id="refreshed" value="no"/>
<script type="text/javascript">
onload=function(){
var e=document.getElementById("refreshed");
if(getCookie('location_url')==location.href){
e.value="no";
}
setTimeout('setCookie(\'location_url\',location.href);', 100)
if(e.value=="no"){ //page loaded on the first time
e.value="yes";
}else{ //page refreshed or back to this page
e.value="no";
//run your code for the event here
e.value="yes";
}
}
onkeypress=function(event){ //page refreshed
if(event.keyCode==116){
var e=document.getElementById("refreshed");
e.value="no";
}
}
onkeydown=function(event){ //page refreshed
if(event.ctrlKey && event.keyCode == 82){
var e=document.getElementById("refreshed");
e.value="no";
}
}
</script>
Friday, February 11, 2011
SHARE - Event handler for page refresh and back button
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment