Browser reload icon functionality should be disabled for a particular page.Even though if it reloads also,the page content should not change.
            Asked
            
        
        
            Active
            
        
            Viewed 7,003 times
        
    0
            
            
        - 
                    1Possible duplicate of [Prevent any form of page refresh using jQuery/Javascript](https://stackoverflow.com/questions/3527041/prevent-any-form-of-page-refresh-using-jquery-javascript) – Nitin Dhomse Nov 15 '17 at 11:49
- 
                    Thank you for your response – Mounika R Nov 16 '17 at 04:45
1 Answers
2
            
            
        You can disable refresh by using the following code
 $(document).on("keydown", function (e) {
        if (e.key == "F5" || e.key == "F11" || 
            (e.ctrlKey == true && (e.key == 'r' || e.key == 'R')) || 
            e.keyCode == 116 || e.keyCode == 82) {
                   e.preventDefault();
        }
    });
Even after this the user can refresh using browser refresh button. If so we can just give a confirmation message using
window.onbeforeunload = function() {
        return "Leave this page ?";
    }
 
    
    
        Sandeep P Pillai
        
- 753
- 1
- 4
- 22
