之前写了篇关于禁止浏览器复制的文章,小编一般用的谷歌浏览器测试没问题,客户用的360浏览器有个插件可以复制
点击这个复制就可以复制了,那怎么禁止这个呢?
<script language="javascript"> function click() { return false;} function click1(){if (event.button==2) {return false; }} function CtrlKeyDown(){ if (event.keyCode==67&&event.ctrlKey) { clipboardData.setData('text',''); return false; } } document.onkeydown=CtrlKeyDown; document.onselectstart=click; document.onmousedown=click1; if (window.Event) document.captureEvents(Event.MOUSEUP); function nocontextmenu(){ event.cancelBubble = true event.returnValue = false; return false; } function norightclick(e){ if (window.Event){ if (e.which == 2 || e.which == 3) return false; } else if (event.button == 2 || event.button == 3) { event.cancelBubble = true; event.returnValue = false;return false;} } document.oncontextmenu = nocontextmenu; // for IE5+ document.onmousedown = norightclick; // for all others </script>
在代码里面添加这段js代码就可以了。快去试试吧
吉公网安备 22020202000301号