ReddyXTream

Blog anti copy - paste script

Mar 5th, 2016
227
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
HTML 0.82 KB | None | 0 0
  1. <script type="text/javascript">
  2. function disableSelection(target){
  3. if (typeof target.onselectstart!="undefined")
  4. target.onselectstart=function(){return false}
  5. else if (typeof target.style.MozUserSelect!="undefined")
  6. target.style.MozUserSelect="none"
  7. else
  8. target.onmousedown=function(){return false}
  9. target.style.cursor = "default"
  10. }
  11. //Sample usages
  12. //disableSelection(document.body)
  13. //disableSelection(document.getElementById("mydiv"))
  14. </script>
  15. <script type="text/javascript">
  16. disableSelection(document.body)
  17. </script>
  18. Some informations of script :
  19. //disableSelection(document.body) = Disable text selecting on the entire body
  20. //disableSelection(document.getElementById("mydiv")) = Disable text selection on element with id="mydiv"
  21. disableSelection(document.body) = Disable text selecting on the entire body of page(s)
Advertisement
Add Comment
Please, Sign In to add comment