I would like to ask if it's possible to disable the refresh of the browser in one page only using angular or javascript.
-
u mean bowser hardware button?Raja Sekar– Raja Sekar2015-03-26 07:30:17 +00:00Commented Mar 26, 2015 at 7:30
-
yes and also the f5 key.Lee Lee– Lee Lee2015-03-26 07:35:40 +00:00Commented Mar 26, 2015 at 7:35
-
1you can prevent f5, but browser refresh is not possible through javascript.Raja Sekar– Raja Sekar2015-03-26 07:42:22 +00:00Commented Mar 26, 2015 at 7:42
-
@Raj, really? that makes me sad :-(. But thanksLee Lee– Lee Lee2015-03-26 07:45:53 +00:00Commented Mar 26, 2015 at 7:45
-
Repeated question answer link. stackoverflow.com/a/25040472/2114046Hisham– Hisham2016-03-22 23:34:53 +00:00Commented Mar 22, 2016 at 23:34
Add a comment
|
3 Answers
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
Comments
Unfortunately we never could. And I believe we never should.
2 Comments
Raja Sekar
this is not a answer. it should be a comment.
yazaki
I think Lee want to know not only the way to achieve but also the possibility to achieve. Therefore Answering 'Impossible' could be answer.