title: Enabling blocked text selection using JavaScript
body: <p>I recently came across a <a href="http://www.seostandards.org/seo-best-practices/hiding-text-with-css-for-seo.html" rel="noreferrer">website that disabled text selection</a>, preventing anyone from easily copying and pasting text. I have a bookmarklet that disables similar attempts to block context menus using JavaScript, and I'm wondering if it would be possible to do something similar for text selection.</p>
  
  <pre><code>function disableSelection(target){
  if (typeof target.onselectstart!="undefined") //For IE
      target.onselectstart=function(){return false}
  else if (typeof target.style.MozUserSelect!="undefined") //For Firefox
      target.style.MozUserSelect="none"
  else //All other route (For Opera)
      target.onmousedown=function(){return false}
  target.style.cursor = "default"
  }
  </code></pre>
  
  <p>Elsewhere the function is called with <code>disableSelection(document.body)</code>. </p>
  
  <p>The solution from my context menu bookmarklet is also probably necessary:</p>
  
  <pre><code>javascript:void(document.onmousedown=null);
  void(document.onclick=null);
  void(document.oncontextmenu=null)
  </code></pre>
  
  <p>Finally, I had seen <a href="https://stackoverflow.com/questions/826782/css-rule-to-disable-text-selection-highlighting">elsewhere on StackOverflow</a> that CSS could also be used:</p>
  
  <pre><code>-webkit-user-select: none;
  -khtml-user-select: none;
  -moz-user-select: none;
  -o-user-select: none;
  user-select: none;
  </code></pre>
  
  <p>Is there a method to fight all of these at once and end this tyranny over my browser? How would I both enable <code>MozUserSelect</code>/<code>SelectStart</code> for all elements and set the CSS properties?</p>