Home » Why Protect your Code?

Why Protect your Code?

Part of the web is the ability share and understand how pages are built. Sometimes a developer will try to protect the code. Right clicking on the browser window pane gives you a message similar to the following.

 

 

 

 

 

So does this really stop someone from wanting to read the page source code to understand how something might be written? Not really. Save the page from your browser with the entire attachments (though those in the CSS probably will not be saved) by using the save option as follows.

When you have saved it, you can then read the code with a text or wsywig editor such as Dreamweaver.

You can also see the javascript used to protect it as well.

So if you have a designer or developer recommending this, it is kinda old thinking. Like them telling you that “This site designed by blahcorp” should also be on it.

 

<!--
 /*****************************************************************
 ***   COPY PROTECTED BY XXXXXX    ****
 ******************************************************************/
 var message="The images on this page are copyrighted.  Please click the Buy Prints option under a photo if you are interested in purchasing a print or electronic rights.";
 function clickIE4(){
 if (event.button==2){
 alert(message);
 return false;
 }
 }
function clickNS4(e){
 if (document.layers||document.getElementById&&!document.all){
 if (e.which==2||e.which==3){
 alert(message);
 return false;
 }
 }
 }
if (document.layers){
 document.captureEvents(Event.MOUSEDOWN);
 document.onmousedown=clickNS4;
 }
 else if (document.all&&!document.getElementById){
 document.onmousedown=clickIE4;
 }
 document.oncontextmenu=new Function("alert(message);return false")
 // -->
 </script>
<script type="text/javascript">
function disableSelection(target){
 if (typeof target.onselectstart!="undefined") //For IE
 target.onselectstart=function(){return false}
 else if (typeof target.style.MozUserSelect!="undefined") //For Firefox
 target.style.MozUserSelect="none"
 else //All other route (For Opera)
 target.onmousedown=function(){return false}
 target.style.cursor = "default"
 }
 </script>