Home > Article > Web Front-end > Web page source code protection (right-clicking, copying, saving as, and viewing source files are prohibited)
1. Disable right-click menu
<script type="text/javascript" language="javascript"> function noMenuTwo(){ if(event.button == 2){ alert('禁止右键菜单!'); return false; } } document.onmousedown = noMenuTwo; //或者 <p oncontextmenu="return false"></p> </script>
2. Disable copying (Ctrl+C)
<script type="text/javascript" language="javascript"> function noCopy(){ alert("禁止使用Ctrl+C进行复制操作!"); event.returnValue = false; } </script> //<body oncopy = "noCopy()">
3. Prohibit saving as
Add code between 6c04bd5ca3fcae76e30b72ad730ca86d36cc49f0c466276486e50c850b7e4956
2b0b25ff593c5b6c03403dd6234ffb2c< ;iframe src='*.htm'>065276f04003e4622c4fe6b64f465b88f920f363442462683100636cb2662870
4. Disable caching
Disable caching by using HTML tags in the page, as follows:
<HEAD> <META http-equiv=Pragma content=no-cache> <META http-equiv=Cache-Control content=no-cache> <META http-equiv=Expires content=0> </HEAD>
5. Prohibit text from selecting css code
body{ -o-user-select:none; -ms-user-select:none; -webkit-user-select:none; -moz-user-select:none; user-select:none; }
The above is the detailed content of Web page source code protection (right-clicking, copying, saving as, and viewing source files are prohibited). For more information, please follow other related articles on the PHP Chinese website!