如何解除网页禁止复制?

JavaScript021

如何解除网页禁止复制?,第1张

可以通过禁用浏览器的js功能来解除网页禁止粘贴,这里以谷歌浏览器为例。

1、同时按住键盘上的“Ctrl”键+“Shift”键+“Del”键打开谷歌浏览器的设置,然后点击页面底部的“高级”按钮:

/iknow-pic.cdn.bcebos.com/d01373f082025aafbd618226f5edab64024f1a8f"target="_blank"title="点击查看大图"class="ikqb_img_alink">/iknow-pic.cdn.bcebos.com/d01373f082025aafbd618226f5edab64024f1a8f?x-bce-process=image%2Fresize%2Cm_lfit%2Cw_600%2Ch_800%2Climit_1%2Fquality%2Cq_85%2Fformat%2Cf_auto"esrc="https://iknow-pic.cdn.bcebos.com/d01373f082025aafbd618226f5edab64024f1a8f"/>

2、点击“高级”按钮之后,在弹出的窗口中向下拉动,然后点击“网站设置”按钮:

/iknow-pic.cdn.bcebos.com/d31b0ef41bd5ad6e229298078fcb39dbb7fd3cf0"target="_blank"title="点击查看大图"class="ikqb_img_alink">/iknow-pic.cdn.bcebos.com/d31b0ef41bd5ad6e229298078fcb39dbb7fd3cf0?x-bce-process=image%2Fresize%2Cm_lfit%2Cw_600%2Ch_800%2Climit_1%2Fquality%2Cq_85%2Fformat%2Cf_auto"esrc="https://iknow-pic.cdn.bcebos.com/d31b0ef41bd5ad6e229298078fcb39dbb7fd3cf0"/>

3、在网站设置中找到“JavaScript”这一项,然后点击一项的按钮:

/iknow-pic.cdn.bcebos.com/9213b07eca8065389db958fe99dda144ac348288"target="_blank"title="点击查看大图"class="ikqb_img_alink">/iknow-pic.cdn.bcebos.com/9213b07eca8065389db958fe99dda144ac348288?x-bce-process=image%2Fresize%2Cm_lfit%2Cw_600%2Ch_800%2Climit_1%2Fquality%2Cq_85%2Fformat%2Cf_auto"esrc="https://iknow-pic.cdn.bcebos.com/9213b07eca8065389db958fe99dda144ac348288"/>

4、在弹出的页面中将JavaScript关闭,这时就解除了网页的禁止粘贴了:

/iknow-pic.cdn.bcebos.com/80cb39dbb6fd5266d5a7c0f9a518972bd507364a"target="_blank"title="点击查看大图"class="ikqb_img_alink">/iknow-pic.cdn.bcebos.com/80cb39dbb6fd5266d5a7c0f9a518972bd507364a?x-bce-process=image%2Fresize%2Cm_lfit%2Cw_600%2Ch_800%2Climit_1%2Fquality%2Cq_85%2Fformat%2Cf_auto"esrc="https://iknow-pic.cdn.bcebos.com/80cb39dbb6fd5266d5a7c0f9a518972bd507364a"/>

<!-- 禁止选择文本: -->

<script type="text/javascript">

var omitformtags=["input", "textarea", "select"]

omitformtags=omitformtags.join("|")

function disableselect(e){

if (omitformtags.indexOf(e.target.tagName.toLowerCase())==-1)

return false

}

function reEnable(){

return true

}

if (typeof document.onselectstart!="undefined")

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

else{

document.onmousedown=disableselect

document.onmouseup=reEnable

}

</script>

<!-- 禁用右键: -->

<script>

function stop(){

return false

}

document.oncontextmenu=stop

</script>

功能:禁止右键、禁选择、禁粘贴、禁shift、禁ctrl、禁alt

<script language="JavaScript">

<!--

function key(){

if(event.shiftKey){

window.close()}

//禁止Shift

if(event.altKey){

window.close()}

//禁止Alt

if(event.ctrlKey){

window.close()}

//禁止Ctrl

return false}

document.onkeydown=key

if (window.Event)

document.captureEvents(Event.MOUSEUP)

function nocontextmenu(){

event.cancelBubble = true

event.returnValue = false

return false}

function norightclick(e){

if (window.Event){

if (e.which == 2 || e.which == 3)

return false}

else

if (event.button == 2 || event.button == 3){

event.cancelBubble = true

event.returnValue = false

return false}

}

//禁右键

document.oncontextmenu = nocontextmenu // for IE5+

document.onmousedown = norightclick // for all others

//-->

</script>

<body onselectstart="return false"onpaste="return false">

1. oncontextmenu="window.event.returnValue=false" 将彻底屏蔽鼠标右键,其实是禁止快捷菜单,因为不光右键可以弹出这个菜单,键盘上空格键右边的windows键也可以激活这个快捷菜单

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

2. <body onselectstart="return false">禁止选取、防止复制

3. onpaste="return false" 禁止粘贴

4. oncopy="return false" oncut="return false" 禁止复制和剪切

5. <input style="ime-mode:disabled">关闭输入法