Home  >  Article  >  Web Front-end  >  jquery disables right-click function and blocks F5 refresh_jquery

jquery disables right-click function and blocks F5 refresh_jquery

WBOY
WBOYOriginal
2016-05-16 16:55:251172browse

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;
}
});
});
Statement:
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