Click here to Skip to main content
15,895,740 members
Please Sign up or sign in to vote.
1.00/5 (1 vote)
See more:
Hi,

We need to disable the Refresh,F5 and Back Space event from keyboard using java script in a master page enabled pages.

Please provide the code to prevent these functionalities.

Regards
Sreejith
Posted

1 solution

try this:

JavaScript
$(window).bind('beforeunload', function(e) {

    if (/*Some condition that will allow refresh*/)
    {
        e.preventDefault();
    }
});
 
Share this answer
 
Comments
Member 11658469 1-Jun-15 9:40am    
Hi,

Please provide a simple javascript code to specify the keys for these functions.

Regards
Sreejith
Andy Lanng 1-Jun-15 9:43am    
F5 and backspace are one thing but they do not prevent the refresh button from being clicked. This code does.

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900