<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>theDeSilva.com&#187; disable selection</title>
	<atom:link href="http://www.thedesilva.com/tag/disable-selection/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.thedesilva.com</link>
	<description>Andrew de Silva</description>
	<lastBuildDate>Wed, 04 Aug 2010 19:27:04 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.0.1</generator>
		<item>
		<title>Disable selection on browser using Javascript</title>
		<link>http://www.thedesilva.com/2010/03/disable-selection-on-browser-using-javascript/</link>
		<comments>http://www.thedesilva.com/2010/03/disable-selection-on-browser-using-javascript/#comments</comments>
		<pubDate>Wed, 10 Mar 2010 21:48:23 +0000</pubDate>
		<dc:creator>Andrew de Silva</dc:creator>
				<category><![CDATA[Javascript]]></category>
		<category><![CDATA[disable select]]></category>
		<category><![CDATA[disable selection]]></category>

		<guid isPermaLink="false">http://www.thedesilva.com/?p=199</guid>
		<description><![CDATA[<img src="http://www.thedesilva.com/img/category_icon//java-duke-logo-small.png" width="60" height="60" alt="" title="Javascript" /><br/>Here&#8217;s a quick way to disable selection on browsers using Javascript. Helpful if you don&#8217;t want somebody to select a bunch of text and copy and paste. 1 2 3 4 5 6 7 8 9 10 11 12 13 window.onload = function&#40;&#41; &#123; disableSelection&#40;document.body&#41; &#125; &#160; function disableSelection&#40;target&#41;&#123; if &#40;typeof target.onselectstart!=&#34;undefined&#34;&#41; //IE target.onselectstart=function&#40;&#41;&#123;return false&#125; [...]]]></description>
			<content:encoded><![CDATA[<img src="http://www.thedesilva.com/img/category_icon//java-duke-logo-small.png" width="60" height="60" alt="" title="Javascript" /><br/><p>Here&#8217;s a quick way to disable selection on browsers using Javascript. Helpful if you don&#8217;t want somebody to select a bunch of text and copy and paste.</p>

<div class="wp_syntax"><table><tr><td class="line_numbers"><pre>1
2
3
4
5
6
7
8
9
10
11
12
13
</pre></td><td class="code"><pre class="javascript" style="font-family:monospace;">window.<span style="color: #000066;">onload</span> <span style="color: #339933;">=</span> <span style="color: #003366; font-weight: bold;">function</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
	disableSelection<span style="color: #009900;">&#40;</span>document.<span style="color: #660066;">body</span><span style="color: #009900;">&#41;</span>
<span style="color: #009900;">&#125;</span>
&nbsp;
<span style="color: #003366; font-weight: bold;">function</span> disableSelection<span style="color: #009900;">&#40;</span>target<span style="color: #009900;">&#41;</span><span style="color: #009900;">&#123;</span>
<span style="color: #000066; font-weight: bold;">if</span> <span style="color: #009900;">&#40;</span><span style="color: #000066; font-weight: bold;">typeof</span> target.<span style="color: #660066;">onselectstart</span><span style="color: #339933;">!=</span><span style="color: #3366CC;">&quot;undefined&quot;</span><span style="color: #009900;">&#41;</span> <span style="color: #006600; font-style: italic;">//IE </span>
	target.<span style="color: #660066;">onselectstart</span><span style="color: #339933;">=</span><span style="color: #003366; font-weight: bold;">function</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#123;</span><span style="color: #000066; font-weight: bold;">return</span> <span style="color: #003366; font-weight: bold;">false</span><span style="color: #009900;">&#125;</span>
<span style="color: #000066; font-weight: bold;">else</span> <span style="color: #000066; font-weight: bold;">if</span> <span style="color: #009900;">&#40;</span><span style="color: #000066; font-weight: bold;">typeof</span> target.<span style="color: #660066;">style</span>.<span style="color: #660066;">MozUserSelect</span><span style="color: #339933;">!=</span><span style="color: #3366CC;">&quot;undefined&quot;</span><span style="color: #009900;">&#41;</span> <span style="color: #006600; font-style: italic;">//Firefox </span>
	target.<span style="color: #660066;">style</span>.<span style="color: #660066;">MozUserSelect</span><span style="color: #339933;">=</span><span style="color: #3366CC;">&quot;none&quot;</span>
<span style="color: #000066; font-weight: bold;">else</span> <span style="color: #006600; font-style: italic;">//All other ie: Opera</span>
	target.<span style="color: #660066;">onmousedown</span><span style="color: #339933;">=</span><span style="color: #003366; font-weight: bold;">function</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#123;</span><span style="color: #000066; font-weight: bold;">return</span> <span style="color: #003366; font-weight: bold;">false</span><span style="color: #009900;">&#125;</span>
target.<span style="color: #660066;">style</span>.<span style="color: #660066;">cursor</span> <span style="color: #339933;">=</span> <span style="color: #3366CC;">&quot;default&quot;</span>
<span style="color: #009900;">&#125;</span></pre></td></tr></table></div>

]]></content:encoded>
			<wfw:commentRss>http://www.thedesilva.com/2010/03/disable-selection-on-browser-using-javascript/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>
