Disable text selection

By frozenmafia on Nov 03, 2012

This snippet disables text selection on all browsers.

/* Switch body to anything else to apply it to only elements matching the criteria (e.g. #noselect or .noselect) */

body{
-webkit-touch-callout: none;
-webkit-user-select: none;
-khtml-user-select: none;
-moz-user-select: none;
-ms-user-select: none;
user-select: none;
}

Comments

Sign in to comment.
Sorasyn   -  Nov 08, 2012

Could be used as a mechanism much like what Wikipedia uses, prevents the text from being immediately ripped off into a plagiarized piece of work. However, Wikipedia, I believe, actually watermarks or modifies the copied text so unless you type it word for word, it's painfully obvious you didn't write the material.

Not that.. I would know or anything... whistles

 Respond  
frozenmafia   -  Nov 04, 2012

I didn't /steal/ it :P it's scattered all over the world wide web!

 Respond  
TMFKSOFT   -  Nov 04, 2012

I'm sure you stole that from my Linux GUI.
It's useful with Jquery Draggable, Sometimes the user ends up selecting half the page when trying to drag something.

 Respond  
frozenmafia   -  Nov 04, 2012

It's useful for stuff like text that's acting as a button or to stop highlighting of an image. If you load an image in Chrome directly, it uses no-select

 Respond  
Abcdefmonkey   -  Nov 04, 2012

Maybe it's copyrighted text? :P No clue. I've actually been on some sites for school and they didn't allow selecting text or even using the copy/paste functions and disabled CTRL-C/V. I would assume for such reasons.

 Respond  
Hawkee   -  Nov 04, 2012

Why would you want to stop somebody from selecting text?

 Respond  
Are you sure you want to unfollow this person?
Are you sure you want to delete this?
Click "Unsubscribe" to stop receiving notices pertaining to this post.
Click "Subscribe" to resume notices pertaining to this post.