秘籍网

网站页面防复制、禁止右键复制粘贴源代码

分类:IT/互联网 时间:2021-11-13 22:14 浏览:440
概述
网站页面防复制、禁止右键复制粘贴源代码页面防复制粘贴、网页防复制代码、禁止右键复制粘贴、禁止右键代码1、防选中、复制、鼠标右键<script type="text/javascript">    document.body.oncontextmenu =     document.body.ondragstart =    
内容

网站页面防复制、禁止右键复制粘贴源代码


页面防复制粘贴、网页防复制代码、禁止右键复制粘贴、禁止右键代码


1、防选中、复制、鼠标右键


<script type="text/javascript">

    document.body.oncontextmenu = 

    document.body.ondragstart = 

    document.body.onselectstart = 

    document.body.onbeforecopy = 

    function () { return false; };

 

    document.body.onselect = 

    document.body.oncopy = 

    document.body.onmouseup = 

    function () { document.selection.empty(); };

</script>


2、防选中、复制、鼠标右键


<script language="JavaScript">

    document.oncontextmenu = new Function('event.returnValue=false;');

    document.onselectstart = new Function('event.returnValue=false;');

</script>


3、禁止查看网页源文件代码,插入网页即可。

<body leftmargin="2" topmargin="0" marginwidth="0" marginheight="0" oncontextmenu="return false" ondragstart="return false" onselectstart ="return false" onselect="document.selection.empty()" oncopy="document.selection.empty()" onbeforecopy="return false" onmouseup="document.selection.empty()">

<noscript><iframe src="/blog/*>";</iframe></noscript>


4、彻底屏蔽鼠标右键

oncontextmenu="window.event.returnvalue=false"

<table border oncontextmenu=return(false)><td>no</table> //可用于Table


5、取消选取、防止复制

<body onselectstart="return false">


6、不准粘贴

onpaste="return false"


7、防止复制

oncopy="return false;" oncut="return false;"


8、防止被人frame

<SCRIPT LANGUAGE=javascript><!-- if (top.location != self.location)top.location=self.location; // --></SCRIPT>


9、禁止网页中目标对象被下载(如图片)

<a href="javascript:void(0)" onMouseDown="alert('对不起!图片不能下载!')"><img src="图片地址" alt="" /></a>


10、页面禁止刷新完全,最好在pop出来的窗口里用,没工具栏的

<body onkeydown="KeyDown()" onbeforeunload="location=location"

oncontextmenu="event.returnValue=false">

<script language="Javascript"><!-- 

function KeyDown(){ 

if ((window.event.altKey)&& 

     ((window.event.keyCode==37)||   

      (window.event.keyCode==39))){alert("请访问我的主页"); 

    event.returnValue=false; 

    } 

if ((event.keyCode==8)||(event.keyCode==116)){//屏蔽 F5 刷新键 

    event.keyCode=0; 

    event.returnValue=false; 

    } 

if ((event.ctrlKey)&&(event.keyCode==78)){   //屏蔽 Ctrl+n 

    event.returnValue=false; 

    } 

if ((event.shiftKey)&&(event.keyCode==121)){ //屏蔽 shift+F10 

    event.returnValue=false; 

    } 

</script> 

</body>


以上是关于“页面防复制粘贴、网页防复制代码、禁止右键复制粘贴、禁止右键代码”


的全部内容。希望对大家有帮助

评论
网站首页 | 关于我们 | 广告合作 | 联系我们 | 隐私条款 | 免责声明 | 网站地图
CopyRight 2019-2029 秘籍网 | 粤ICP备07074235号,继续教育学院秘籍网_职业技能培训班课程【秘籍网站平台】
展开