Share this page 

Disable text selection in a pageTag(s): Varia


This javascript disables the ability to select text with mouse. You can try it on this page (works on IE and FF).
<SCRIPT type="text/javascript">
if (typeof document.onselectstart!="undefined") {
  document.onselectstart=new Function ("return false");
}
else{
  document.onmousedown=new Function ("return false");
  document.onmouseup=new Function ("return true");
}
</SCRIPT>
However, it's not a good "protection" because you can return to the normal behaviour with a simple javascript url :

IE here to put back the mouse selection
FF here to put back the mouse selection

... and if Javascript is disabled then the protection is not effective!