Js disables page refresh and rewind, and js page refresh and rewind
This article describes how to disable page refresh and rewind in js. Share it with you for your reference. The specific implementation method is as follows:
<Script language = "javascript"> // disable function document with the F5 key. onkeydown () {if (event. keyCode = 116) {event. keyCode = 0; event. cancelBubble = true; return false ;}// right-click the menu to bring up function document. oncontextmenu () {return false;} // the following code displays the function window in full screen. onload () {var Request = new Array (); // Save the parameter var s = location. search. substring (1); if (s & s! = "") {Var list = s. split ("&"); for (var I = 0; I <list. length; I ++) {var pair = list [I]. split ("="); if (pair [0] & pair [0]! = "") {Request [unescape (pair [0])] = unescape (pair [1]) ;}} var fullscreen = Request ["fullscreen"]; if (fullscreen! = "Yes") {var file = self. location; var a = window. open ("about: blank", "", "fullscreen = yes"); self. opener = null; self. close ();. location = file + "? Fullscreen = yes ";}}</script> <script language =" Javascript "> <! -- // Shield right-click, Ctrl + N, Shift + F10, F11, F5 refresh, backspace key // Author: meizz (plum blossom rain) 2002-6-18 function document. oncontextmenu () {event. returnValue = false;} // right-click the screen and select function window. onhelp () {return false} // block the F1 help function document. onkeydown () {if (window. event. altKey) & (window. event. keyCode = 37) | // mask Alt + direction key trim (window. event. keyCode = 39) // block Alt + direction keys → {alert ("You are not allowed to use ALT + direction keys to move forward or backward the webpage! "); Event. returnValue = false;}/* Note: this does not really block Alt + direction keys, because when the Alt + direction keys pop up the warning box, hold down the Alt key and drop the warning box with the mouse, this blocking method becomes invalid. In the future, if any expert has a method to block the Alt key, please let us know. */If (event. keyCode = 8) | // specifies the event that is used to block the unsigned deletion key. keyCode = 116) | // block the F5 refresh key (event. ctrlKey & event. keyCode = 82) {// Ctrl + R event. keyCode = 0; event. returnValue = false;} if (event. keyCode = 122) {event. keyCode = 0; event. returnValue = false;} // block F11 if (event. ctrlKey & event. keyCode = 78) event. returnValue = false; // block Ctrl + n if (event. shiftKey & event. keyCode = 121) event. returnValue = false; // block shift + F10 if (window. event. srcElement. tagName = "A" & window. event. shiftKey) window. event. returnValue = false; // block shift with the left mouse button to open a new page if (window. event. altKey) & (window. event. keyCode = 115) // mask Alt + F4 {window. showModelessDialog ("about: blank", "", "dialogWidth: 1px; dialogheight: 1px"); return false ;}</script>
I hope this article will help you design javascript programs.