防止复制粘贴选项 [英] Prevent Copy Paste options

查看:92
本文介绍了防止复制粘贴选项的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

大家好,





我正在创建一个文档管理系统。这是客户的要求。



1)当我们点击创建链接时,文档应该在浏览器中打开 - 完成

2)防止从某些外部文档复制并粘贴到系统文件 - 防止右键单击和cntrl c反之亦然

3)应用程序中的复制/粘贴应该可用.--请指导我最后一点如何进行此操作。

解决方案

防止右键单击...





 <   script  >  
var isNS =(navigator.appName ==Netscape)? 1:0;

if(navigator.appName ==Netscape)document.captureEvents(Event.MOUSEDOWN || Event.MOUSEUP);

函数mischandler(){
返回false;
}

函数mousehandler(e){
var myevent =(isNS)? e:事件;
var eventbutton =(isNS)? myevent.which:myevent.button;
if((eventbutton == 2)||(eventbutton == 3))return false;
}
document.oncontextmenu = mischandler;
document.onmousedown = mousehandler;
document.onmouseup = mousehandler;

< / script >







身体标签



< body oncontextmenu =return falseonselectstart =return falseöndragstart=return false>< / body> 


单独防止复制和粘贴


java脚本中的



  function  killCopy(e){
return false
}

function reEnable(){
return true
}

document.onselectstart = new 功能 return false
if ( window.sidebar){
document.onmousedown = killCopy
document.onclick = reEnable
}







in html body标签



ondragstart =return falseonselectstart =return falseoncontextmenu =return false


Hi All,


I am creating a Document Management System.Below are the requirment from the client.

1) When we click on create link a document should get open within the browser - Done
2) Prevent copy from some external document and paste in the document of the system - Prevented right click and cntrl c and vice versa
3) Copy/Paste within the application should be available.-- Please guide me on the last point how to go ahead of this.

解决方案

To Prevent right Click ...


<script>
var isNS = (navigator.appName == "Netscape") ? 1 : 0;

if(navigator.appName == "Netscape") document.captureEvents(Event.MOUSEDOWN||Event.MOUSEUP);

function mischandler(){
return false;
}

function mousehandler(e){
var myevent = (isNS) ? e : event;
var eventbutton = (isNS) ? myevent.which : myevent.button;
if((eventbutton==2)||(eventbutton==3)) return false;
}
document.oncontextmenu = mischandler;
document.onmousedown = mousehandler;
document.onmouseup = mousehandler;

</script>




At body tag

<body oncontextmenu="return false" onselectstart="return false"  öndragstart="return false"></body>


To Prevent Copy and Paste alone

in java script

function killCopy(e){
    return false
}

function reEnable(){
    return true
}

document.onselectstart=new Function ("return false")
if (window.sidebar){
    document.onmousedown=killCopy
    document.onclick=reEnable
}




in html body tag

ondragstart="return false" onselectstart="return false" oncontextmenu="return false"


这篇关于防止复制粘贴选项的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆