有时候客户让加代码不让别人偷他的图片,文章之类的,需要用一些 js 屏蔽鼠标动作。
<script> document.oncontextmenu=new Function("event.returnValue=false"); //禁止右键功能 document.onselectstart=new Function("event.returnValue=false"); //禁止选择文字 </script>
「本文由 Savalone 原创或搜集整理发布,转载请遵守 CC BY-NC-ND 4.0 许可!」