1.不管你是PHP html js css 代码
你可以选择给代码加密,百度上搜索:在线PHP加密会有很多平台可以加密的,每个平台的加密方式都有大同小异 功能差距也有不同 加密的功能也不同,在这我也就不推荐某平台了 动动小手自己搜索一下加密即可!
新建一个文本文件,把源代码全部复制到加密平台加密,然后把加密后的代码全部复制粘贴到新建的文本文件里,然后修改文本的后缀名即可!
2.如果你是html里的H5语言代码,你也可以在源代码里添加一些禁止代码。
1.禁用浏览器右键菜单
document.oncontextmenu = new Function("return false;");
2.监听键盘事件
document.onkeydown = document.onkeyup = document.onkeypress = function(event) { var e = event || window.event || arguments.callee.caller.arguments[0]; if (e && e.keyCode == 123) { window.location = 'about: blank'; e.returnValue = false; return (false); } }
3.检测控制台
function mAlert() { var fn = function () {}; fn.toString = function () { window.location = 'about: blank'; console.log("呵呵"); } console.log("%c", fn);//请不要删除这行 };mAlert();
4.鼠标点击事件
document.onmousedown = function mdClick(event) { var e = event || window.event || arguments.callee.caller.arguments[0]; if (e.button == 2 || e.button == 3) { alert("呵呵"); //不建议用以下方法,易错率大 window.location = 'about: blank'; } }
5.禁止保存
document.onkeydown = function() { if ((e.ctrlKey) && (e.keyCode == 83)) { //ctrl+s alert("ctrl+s被禁用"); return false; } }
6.css禁止左键右键 //左键
//左键 〈body onselectstart="return false"〉 //右键 〈body οncοntextmenu='return false'〉
本文作者为萝莉工坊,转载请注明。