1000字范文,内容丰富有趣,学习的好帮手!
1000字范文 > HTML页面禁止选择 页面禁止复制 页面禁止右键

HTML页面禁止选择 页面禁止复制 页面禁止右键

时间:2019-06-29 18:09:50

相关推荐

HTML页面禁止选择 页面禁止复制 页面禁止右键

HTML页面内容禁止选择、复制、右键

刚在一个看一个站点的源代码的的时候发现的,其实原来真的很简单

<body leftmargin=0 topmargin=0 οncοntextmenu='return false' οndragstart='return false' onselectstart ='return false' οnselect='document.selection.empty()' οncοpy='document.selection.empty()' onbeforecopy='return false' οnmοuseup='document.selection.empty()'>

关键就在

οncοntextmenu='return false'

οndragstart='return false'

onselectstart ='return false'

οnselect='document.selection.empty()'

οncοpy='document.selection.empty()'

onbeforecopy='return false'

οnmοuseup='document.selection.empty()'

一个更简单的方法就是在<body>中加入如下的代码,这样鼠标的左右键都失效了.

topmargin="0" οncοntextmenu="return false" οndragstart="return false" onselectstart ="return false" οnselect="document.selection.empty()" οncοpy="document.selection.empty()" onbeforecopy="return false" οnmοuseup="document.selection.empty()"

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

<noscript>

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

</noscript>

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

<body οnmοusemοve=/HideMenu()/ οncοntextmenu="return false" οndragstart="return false" onselectstart ="return false" οnselect="document.selection.empty()" οncοpy="document.selection.empty()" onbeforecopy="return false" οnmοuseup="document.selection.empty()">

本内容不代表本网观点和政治立场,如有侵犯你的权益请联系我们处理。
网友评论
网友评论仅供其表达个人看法,并不表明网站立场。