JS prohibits copying web page code
<! DOCTYPE HTML PUBLIC "-//W3C//DTD XHTML 1.0 transitional//en" "Http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd ">
<html xmlns= "http://www.jzread.com/1999/xhtml" >
<head>
<meta http-equiv= "Content-type" content= "HTML; charset=gb2312 "/>
<title>js prohibit copying of Web page code </title>
<script type= "Text/javascript" >
Document.body.oncopy = nocopy;
function Nocopy () {
Clipboarddata.setdata ("Text", "");
SetTimeout (nocopydelay,100);
}
function Nocopydelay () {
Alert ("Cannot copy");
Clipboarddata.setdata ("text", "haha" + "rn" article from: jzread.com detailed reference: "+location.href);"
}
Method Two
Function rf ()
{return false;}
document.oncontextmenu = RF
function KeyDown ()
{ if (Event.ctrlkey ==true | | event.keycode ==93 | | Event.shiftkey ==true) {return false;}}
document.onkeydown =keydown
function drag ()
{ return false;
Document.ondragstart=drag
function Stopmouse (e) {
if (navigator.appname = ' Netscape ' && (E.which = 3 | | e.which = 2))
return false;
else if
(navigator.appname = = ' Microsoft Internet Explorer ' && ( Event.button = 2 | | Event.button = = 3)) {
//alert ("");
return false;
}
return true;
}
Document.onmousedown=stopmouse;
if (document.layers)
window.captureevents (event.mousedown);
Window.onmousedown=stopmouse;
</script>
</head>
<script language= "JavaScript"
<!--
Function key () {
if (Event.shiftkey) {
Window.close ();}
//Disable Shift
if (event.altkey) {
Window.close ();}
//No ALT
if (event.ctrlkey) {
Window.close ();}
//Prevent 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;
}
//Right-button
Document.oncontextmenu = nocontextmenu; //for ie5+
Document.onmousedown = norightclick; //For all others
//-->
</script>
<body onselectstart= ' return false '; Onpaste= "return false";>
JS prohibitedCopy Web page code
</body>
</html>