1

I would like to ask if it's possible to disable the refresh of the browser in one page only using angular or javascript.

5
  • u mean bowser hardware button? Commented Mar 26, 2015 at 7:30
  • yes and also the f5 key. Commented Mar 26, 2015 at 7:35
  • 1
    you can prevent f5, but browser refresh is not possible through javascript. Commented Mar 26, 2015 at 7:42
  • @Raj, really? that makes me sad :-(. But thanks Commented Mar 26, 2015 at 7:45
  • Repeated question answer link. stackoverflow.com/a/25040472/2114046 Commented Mar 22, 2016 at 23:34

3 Answers 3

3
document.onkeydown = function(){
  switch (event.keyCode){
        case 116 : //F5 button
            event.returnValue = false;
            event.keyCode = 0;
            return false;
        case 82 : //R button
            if (event.ctrlKey){ 
                event.returnValue = false;
                event.keyCode = 0;
                return false;
            }
    }
}

This code helps you to prevent f5 and ctrl + R functionality

Sign up to request clarification or add additional context in comments.

Comments

2

Unfortunately we never could. And I believe we never should.

2 Comments

this is not a answer. it should be a comment.
I think Lee want to know not only the way to achieve but also the possibility to achieve. Therefore Answering 'Impossible' could be answer.
0
$(function($){
   $('[data-toggle="redirect"]').click(function(e){
    e.preventDefault();
    window.location = $(this).attr('href');
   });
   $('.job-popup').click(function(e){
    e.preventDefault();
   });
});

It will help you dude

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.