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!




If you find this article useful, consider making a small donation
to show your support for this Web site and its content.

Written and compiled by Réal Gagnon ©1998-2012
[ home ]