Posted By

localhorst on 03/18/08


Tagged

select copy protect mootools


Versions (?)

Who likes this?

3 people have marked this snippet as a favorite

SpinZ
blackabee
wirenaught


website copy protection


 / Published in: JavaScript
 

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.

  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  

You need to login to post a comment.