JS禁止F12和鼠标右键代码
4592
一共两块代码 一个禁止F12和鼠标右键代码 代码可以禁止别人F12和鼠标右键代码 可以防止别人偷去你的代码和你的源码
- //禁止右键
- function click(e) {
- if (document.all) {
- if (event.button == 2 || event.button == 3) {
- alert("禁止恶意拿代码的");
- oncontextmenu = "return false";
- }
- }
- if (document.layers) {
- if (e.which == 3) {
- oncontextmenu = "return false";
- }
- }
- }
- if (document.layers) {
- document.captureEvents(Event.MOUSEDOWN);
- }
- document.onmousedown = click;
- document.oncontextmenu = new Function("return false;");
- document.onkeydown = document.onkeyup = document.onkeypress = function() {
- if (window.event.keyCode == 12) {
- window.event.returnValue = false;
- return false;
- }
- };
- //禁止F12
- function fuckyou() {
- window.close();
- //关闭当前窗口(防抽)
- window.location = "about:blank";
- }
- function click(e) {
- if (document.all) {
- if (event.button == 2 || event.button == 3) {
- alert("禁止恶意拿代码的");
- oncontextmenu = "return false";
- }
- }
- if (document.layers) {
- if (e.which == 3) {
- oncontextmenu = "return false";
- }
- }
- }
- if (document.layers) {
- fuckyou();
- document.captureEvents(Event.MOUSEDOWN);
- }
- document.onmousedown = click;
- document.oncontextmenu = new Function("return false;");
- document.onkeydown = document.onkeyup = document.onkeypress = function() {
- if (window.event.keyCode == 123) {
- fuckyou();
- window.event.returnValue = false;
- return false;
- }
- };
本文网址:https://www.zztuku.com/index.php/detail-7651.html
站长图库 - JS禁止F12和鼠标右键代码
申明:如有侵犯,请 联系我们 删除。
您还没有登录,请 登录 后发表评论!
提示:请勿发布广告垃圾评论,否则封号处理!!