How to disable Refresh button on Browser Using Javascript

Posted by Sureshknkt7 under JavaScript on 10/26/2012 | Points: 10 | Views : 28246 | Status : [Member] | Replies : 3
Hi,


Here I face a situation,

I want to disable refresh button on browser because onmouse click user can be refresh the page
Here user doesn't allow to refresh the page
how to disable the refresh button on browser using javascript?




Responses

Posted by: Laurenrodriguez on: 10/26/2012 [Member] Starter | Points: 25

Up
0
Down
Hi,

Try this code.



<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=windows-1252">
<title>Block F5 Key In IE & Mozilla</title>

<script language="JavaScript">

var version = navigator.appVersion;

function showKeyCode(e) {
var keycode = (window.event) ? event.keyCode : e.keyCode;

if ((version.indexOf('MSIE') != -1)) {
if (keycode == 116) {
event.keyCode = 0;
event.returnValue = false;
return false;
}
}
else {
if (keycode == 116) {
return false;
}
}
}

</script>

</head>
<body onload="JavaScript:document.body.focus();" onkeydown="return showKeyCode(event)">
</body>
</html>

Sureshknkt7, if this helps please login to Mark As Answer. | Alert Moderator

Posted by: Sureshknkt7 on: 10/26/2012 [Member] Starter | Points: 25

Up
0
Down
Hi Laurenrodriguez ,

Thanks for your reply..

User have the chances to refresh the page in three ways

1) By using F5 key
2) By using Rightclick mouse button
3)By using Browser refresh button

Above first and second I got it in javascript.

but I need to disable the browser refresh button...




Sureshknkt7, if this helps please login to Mark As Answer. | Alert Moderator

Posted by: Bapujin on: 4/13/2016 [Member] Starter | Points: 25

Up
0
Down
any solution for stopping browser refresh button

Sureshknkt7, if this helps please login to Mark As Answer. | Alert Moderator

Login to post response