如何不让别人查看自己网站的原码 禁用右键的用处和使用

 

 

 

在自己的网页原码 <body> 中加入下面的代码就 可以了   

<body oncontextmenu="return false" onselectstart="return false" 

ondragstart="return false" onbeforecopy="return false" oncopy=document.selection.empty() onselect=document.selection.empty()>

 

第二种方法:<body onContextMenu="return false" onSelectStart="return false">      浏览器需要在 IE5 以上

第三种方法:

<script language="JavaScript">
function click()
{
if(event.button==2)
{
alert('右键已被禁用!')
}
}
document.onmousedown=click
</script>



 

禁止网页另存为:在<body>后面加入以下代码: 

<noscript> 
<iframe src="*.htm"></iframe> 
</noscript> 

禁止网页内容复制.粘贴:在<body>中加入以下代码: 

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

 

评论 5
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值