JavaScript 禁用鼠标右键代码及绕过方案

作者:拾光时间:2026-10-24 11:10:57浏览:567

本文提供一段用于禁用网页鼠标右键的 JavaScript 代码,涵盖 IE 及 Netscape 浏览器的兼容处理。同时介绍一种通过安装新浏览器并禁用 JS 功能来绕过该限制的方法,适用于需要查看受保护内容的场景。

禁用鼠标右键的 JavaScript 实现

将以下 JavaScript 代码插入网页即可实现功能。


[html]


<script type="text/javascript">


<!--

var message="";


///////////////////////////////////

function clickIE() {if (document.all) {(message);return false;}}


function clickNS(e) {if


(document.layers||(document.getElementById&&!document.all)) {


if (e.which==2||e.which==3) {(message);return false;}}


if (document.layers)


{document.captureEvents(Event.MOUSEDOWN);document.onmousedown=clickNS;}


else{document.onmouseup=clickNS;document.oncontextmenu=clickIE;}


document.oncontextmenu=new Function("return false")


// -->

</script>


[/code]



绕过屏蔽的限制方法

破解方法:建议再安装一个浏览器,然后禁掉js,用这个浏览器专门访问各种用js控制的代码。

作者最新文章