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
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!