Created
December 12, 2009 02:31
-
-
Save minichiello/254683 to your computer and use it in GitHub Desktop.
Prevents the copying of texts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<script type="text/javascript"> | |
document.oncontextmenu = function(){return false} | |
document.onselectstart = function(){ | |
if (event.srcElement.type != "text" && event.srcElement.type != "textarea" && event.srcElement.type != "password") | |
return false; | |
else | |
return true; | |
}; | |
if (window.sidebar){ | |
document.onmousedown=function(e){ | |
var obj=e.target; | |
if (obj.tagName.toUpperCase() == "INPUT" || obj.tagName.toUpperCase() == "TEXTAREA" || obj.tagName.toUpperCase() == "PASSWORD") | |
return true; | |
/*else if (obj.tagName=="BUTTON"){ | |
return true; | |
}*/ | |
else | |
return false; | |
} | |
} | |
if (parent.frames.length > 0) top.location.replace(document.location); | |
</script> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment