Setting Web page content does not allow copying

Source: Internet
Author: User
Tags password protection

1, after <HEAD> add the following content, you can achieve a simple page content is not allowed to copy the function. However, it is not possible to actually implement "view Source", see references.

<script language=javascript> if (top.location! = self.location) {top.location=self.location;} </SCRIPT>
<noscript><iframe src=*></iframe></noscript>
<body oncontextmenu= "return false" ondragstart= "return false" Onselectstart = "return false" onselect= " Document.selection.empty () "oncopy=" Document.selection.empty () "onbeforecopy=" return false "onmouseup=" Document.selection.empty () ">

Reference documents:

How to set the Prohibit view source file in a Web page:
Http://www.gdvip.cn/data/2006/0413/article_96.htm
Defend your home: Add a lock to your Web page
Http://www.enet.com.cn/article/2005/0310/A20050310397167_5.shtml

2, <script>function Document.oncontextmenu () {event.returnvalue=false;} Block right mouse button </script>

3. In the body attribute, add

<body onbeforecopy= "return false" oncontextmenu= "return False"
Oncopy=document.selection.empty (2) ondragstart= "return false"
Onmouseup=document.selection.empty (2) onselect=document.selection.empty (2)
Onselectstart= "return False" >

4, in fact, as long as you put the site source code to encrypt it can
Add the following code to the Web page <body oncontextmenu= "return false" onselectstart= "return False"
Ondragstart= "return false" onbeforecopy= "return False" Oncopy=document.selection.empty () onselect= Document.selection.empty () >
This can also be <script language= "JavaScript" >
function Helpor_net ()
{
if (event.button==2) alert (' for browsing only! Thank you!\n\n if you have any questions please contact me! ‘)
}
</script>

Then change <body> to <body onmousedown= "helpor_net ()" >


If you have the energy to look at the following code:
Prohibit save page
1. Prohibit Save As
<nos cript><iframe Src=-.html></iframe></nos cript>
Join the head.

2. Prohibit right-click
<body oncontextmenu= "return false" >
Or
<s cript language= "Javas cript" >
<!--

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
-
</S cript>

3. Let the page text not be selected and copied
<body onselectstart= "return false" >
Or
<body Oncopy=alert (' Sorry, no copying! ');event.returnvalue=false;>

4. Lock status bar text to prevent the address from appearing
<body onmouseover= "self.status= ' text '; return true" >


7. Prohibit image download
At the end of <body......> here add:
Oncontextmenu= "return false" ondragstart= "return false" onselectstart= "return false" scroll= "Auto"

5. Disable caching
<meta http-equiv= "Expires" content= "0" >
<meta http-equiv= "Cache-control" content= "No-cache" >
<meta http-equiv= "Pragma" content= "No-cache" >
Put it in the head.

6. Use the Include Page
Encrypt the included page address, using the tool htmlguardian5.3.5
Currently the most powerful HTML code encryption software, can protect the connection and the HTML code is stolen. 1. Right-click the lock. 2. Disable Mouse circle. 3. Offline use is not allowed. 4. Password protection. 5. The Status bar URL address is not displayed. 6. Full code or local code protection. 7. Link Tracking. 8. Prohibit printing (ie5+). 9. Compress the code (before it is unencrypted). 10. *.html *.js *.asp *.vbs can be encrypted. 11. Two different encryption algorithms. 12. Encrypt the frameset structure. 13. Some features support several different versions of the browser

Originally from: Http://hi.baidu.com/wleistrive/item/9f4b433bdf17b65381f1a7da

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.