website copy protection


/ Published in: JavaScript
Save to your folder(s)

I know what you think - no discussion about this needless piece of code to prevent copying texts/images from websites, but there are customers outside that are advising resistant and so I use this code to scare off their potential clienteles.


Copy this code and paste it in your HTML
  1. // this needs mootools framework and disable rightclick or better the contextmenu
  2. document.addEvent('contextmenu',function(e){
  3. e=new Event(e);
  4. //alert('success');
  5. e.stop();
  6. });
  7.  
  8.  
  9. function selectnone() {
  10. document.body.ondrag = function () { return false; };
  11. document.body.onselectstart = function () { return false; };
  12. if(window.ie || window.opera){document.body.setProperty("unselectable","on");}
  13. if(window.gecko){document.body.setStyle("MozUserSelect","none");}
  14. if(window.webkit){document.body.setStyle("KhtmlUserSelect","none");}
  15.  
  16. }
  17.  
  18.  
  19. // call selectnone() onload/domready

Report this snippet


Comments

RSS Icon Subscribe to comments

You need to login to post a comment.