Skip to content

disable copy paste

July 16, 2008

<sourcecode lang=”javascript”>

if (typeof target.onselectstart!=”undefined”) //IE route
target.onselectstart=function(){return false}
else if (typeof target.style.MozUserSelect!=”undefined”) //Firefox route
target.style.MozUserSelect=”none”
else //All other route (ie: Opera)
target.onmousedown=function(){return false}

target.style.cursor = “default”

[/sourcecode]

So basically two things.

IF IE  then set the onselectstart function returning false

if Mozilla / FF set the style MozUserSelect  as none

else for Opera set the mousedown to return false.

Advertisements
No comments yet

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: