136  
查询码:00000161
js方法禁止查看源文件、防止复制、禁止右键、总结
作者: 魏路 于 2019年12月27日 发布在分类 / 数字可视化 / 三维制作设计 下,并于 2019年12月27日 编辑
右键 另存为 粘贴 复制

1、锁定右键

< body oncontextmenu = "return false" ondragstart = "return false" onselectstart = "return false" onselect = "document.selection.empty()" oncopy = "document.selection.empty()" onbeforecopy = "return false" onmouseup = "document.selection.empty()" >

2.拒绝另存

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

3.不准粘贴

οnpaste= "return false" 

4.防止复制

οncοpy= "return false;" oncut="return false;"

5.关闭输入法

< input style = "ime-mode:disabled" >

6.JS 屏蔽鼠标右键

/** 屏蔽鼠标右键 */  

document.oncontextmenu = function(){ return false ;} 

//或者 

document.onmousedown = function(event){ 

      event = window.event || event;

      if (document.all && event.button == 2 ) {

            event.returnvalue= false

       } 

 }



 推荐知识

 历史版本

修改日期 修改人 备注
2019-12-27 17:04:19[当前版本] 魏路 v1.0

知识分享平台 -V 4.8.7 -wcp