views:

533

answers:

2

Hi friends,

I found that if you press F5 or refresh from browser window, the last event fires again. For ex. I have clicked on a button the button event is carried out normally, but if i press F5 from browser window then the same event is fired again.

Could someone have any idea?

Thanks for sharing your valuable time.

A: 

It is not a bug. It is by design.

When you press F5/Refresh, it sends the same request to server again.

NinethSense
+2  A: 

As per NinenthSense, thats how the browser reacts when the user refresh the page.

If you still want to restrict you can go for some javascript like below

//to avaoid pressing F5 key

document.onkeydown = function()
 {
          if(event.keyCode==116) {
          event.keyCode=0;
          event.returnValue = false;
          }
}

//to avoid refresh, using context menu of the browser

document.oncontextmenu = function() {event.returnValue = false;}
solairaja
Thanks buddy!!!
IrfanRaza
kindly vote when u accept the answer
solairaja