Protect Your Web Page Content

Submitted by:Andery Smith

Date added:13 August, 2011

Category:JavaScript

Although there really isn't any foolproof way to protect your web page content, this JavaScript will discourage the more novice Internet users from copying your content.

An alert box will appear displaying your copyright information when the right mouse button is clicked. However, this script will not completely protect your content from more experienced users.

Copy and Paste the following code into the BODY of your web page. Insert your own copyright information where indicated in red.

Tags: protect content

Code Snippet:

<SCRIPT language="JavaScript">
<!-- Your Guide to Professional Web Site Design and Development
var message="Copyright Year by Your Site. WARNING ! All content contained within this site is protected by copyright laws. Unauthorized use of our material is strictly prohibited.";
function click(e) {
if (document.all) {
if (event.button==2||event.button==3) {
alert(message);
return false;
}
}
if (document.layers) {
if (e.which == 3) {
alert(message);
return false;
}
}
}
if (document.layers) {
document.captureEvents(Event.MOUSEDOWN);
}
document.onmousedown=click;
// -->
</SCRIPT>
 
 

Comments