Monday, October 31, 2011

Stop your content being copied



Want to protect your source code? Using this code will prevent the vast majority of users from right-clicking over a page and choosing "View source", or right-clicking over an image and saving it. There are other ways to view the code, though... This is not always a wise technique to use - it would have to be a very special piece of code to want to hide, and those who would want to steal it will always be able to find a way to see it.
<SCRIPT TYPE="text/javascript">
<!--
//Disable right click script
//visit http://www.technomaina.blogspot.com
var message="Sorry, right-click has been disabled";
///////////////////////////////////
function clickIE() {if (document.all) {(message);return false;}}
function clickNS(e) {if
(document.layers||(document.getElementById&&!document.all)) {
if (e.which==2||e.which==3) {(message);return false;}}}
if (document.layers)
{document.captureEvents(Event.MOUSEDOWN);document.onmousedown=clickNS;}
else{document.onmouseup=clickNS;document.oncontextmenu=clickIE;}
document.oncontextmenu=new Function("return false")
// -->
</SCRIPT> 
Place the above code into <HEAD></HEAD> of your HTML.   ....

To disable the IE imagetoolbar also add the META TAG below to the HEAD
<META HTTP-EQUIV="imagetoolbar" CONTENT="no">


To protect TEXT add 'Disable Text Select' code below into <HEAD></HEAD> of your HTML.

<SCRIPT TYPE="text/javascript">
<!--
//Disable select-text script (IE4+, NS6+)
//visit http://www.technomaina.blogspot.com
///////////////////////////////////
function disableselect(e){
return false
}
function reEnable(){
return true
}
//if IE4+
document.onselectstart=new Function ("return false")
//if NS6
if (window.sidebar){
document.onmousedown=disableselect
document.onclick=reEnable
}
// -->
</SCRIPT>


Ways to protect your images

To start off, the straight truth is there is no 100% way to protect your images short of not displaying them on the Internet to begin with. There are many ways to prevent a novice visitor, but no matter what you try, there will ALWAYS be a way to get any image. That said, here are a few attempts you may try in no particular order.

1. Using CSS to position a transparent gif overtop of the image.
<img src="myimage.gif" width="100" height="50">
<img src="transparent.gif" width="100" height="50" style="position:relative; left:-102px; top:0px;">


2. Using span tag to position a transparent gif overtop of the image.
<span style="background-image: url(images/my_image.jpg)"><img src="images/transparent.gif" width="200" height="150" border="0" alt="My protected Image."></span>


3. Use the image as a background of a table and fill the cell with a transparent gif. 
<table width="100" height="50">
<tr>
<td background="myimage.gif">
<img src="transparent.gif" width="100" height="50">
</td>
</tr>
</table>


4. Use a watermark.
That is, put a mark on the actual image with an image software. A word, a small graphic logo, anything that would deter a thief but still look nice visually for the common visitor.


1 comments:

Anonymous said...

But every browser provides a menu option to view source-code.This would not help.If only it is a pop up window,then it is likely to be effective

Post a Comment

Twitter Delicious Facebook Digg Stumbleupon Favorites More