Home > Web Front-end > JS Tutorial > body text

jquery disables right-click function and blocks F5 refresh_jquery

WBOY
Release: 2016-05-16 16:55:25
Original
1177 people have browsed it

1. Disable the right-click function

Copy the code The code is as follows:

$(document). ready(function() {
$(document).bind("contextmenu",function(e) {
alert("sorry! No right-clicking!");
return false;
});
});

2. Block F5 refresh
Copy code Code As follows:

$(document).ready(function() {
$(document).bind("keydown",function(e){
e=window.event| |e;
if(e.keyCode==116){
e.keyCode = 0;
return false;
}
});
});
Related labels:
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template