Disabling text selection/highlighting
4 posters
Page 1 of 1
Disabling text selection/highlighting
Is there a way to disable text selection in Javascript/HTML to avoid copying of the text in forums? There are multiple codes in both Javascript and HTML available on the Internet, but they do not seem to work when copied to Modules >> HTML & Javascript >> HTML/Javascript subkategories. Is there a certain code that would be effective in forums' topics?
Last edited by teshrin on June 19th 2012, 4:35 pm; edited 1 time in total
teshrin- New Member
- Posts : 4
Reputation : 0
Language : Estonian
Location : Tartu
Re: Disabling text selection/highlighting
::selection{background:transparent;}
::-moz-selection{background:transparent;}
::-moz-selection{background:transparent;}
Re: Disabling text selection/highlighting
Yeah, it'll make it look like it's not selectableRideem3 wrote:Ryanette wrote:::selection{background:transparent;}
::-moz-selection{background:transparent;}
That won't stop it. It will simply take away the blue highlight.
Stopping it completely is impossible since there's always viewing the source and copying it from there, DOM inspection tools, and etc.
Re: Disabling text selection/highlighting
Shouldn't this work:
If not, then this:
(This is CSS by the way, not Javascript, and so goes in the CSS)
- Code:
body {
-moz-user-select: -moz-none;
-khtml-user-select: none;
-webkit-user-select: none;
-ms-user-select: none;
user-select: none;
}
If not, then this:
- Code:
* {
-moz-user-select: -moz-none;
-khtml-user-select: none;
-webkit-user-select: none;
-ms-user-select: none;
user-select: none;
}
(This is CSS by the way, not Javascript, and so goes in the CSS)
LGforum- Hyperactive
- Posts : 2265
Reputation : 264
Language : English
Location : UK
Re: Disabling text selection/highlighting
Alright. This CSS code works in Mozilla, Chrome, Safari and Songbird, but not in IE or Opera. Are there any additional codes to disable highlighting in those two?
teshrin- New Member
- Posts : 4
Reputation : 0
Language : Estonian
Location : Tartu
Re: Disabling text selection/highlighting
It will prevent it in IE9 because of this property: -ms-user-select: none;
I believe that's a valid property as of IE9. Though you may need to perform this edit so your forumotion board doesn't prevent the IE9 rendering engine from being used: http://www.avacweb.com/t294-allow-border-radius-in-ie9
I'm not sure if Opera supports the user-select property. But you can try by adding the property: -o-user-select: none
I believe that's a valid property as of IE9. Though you may need to perform this edit so your forumotion board doesn't prevent the IE9 rendering engine from being used: http://www.avacweb.com/t294-allow-border-radius-in-ie9
I'm not sure if Opera supports the user-select property. But you can try by adding the property: -o-user-select: none
LGforum- Hyperactive
- Posts : 2265
Reputation : 264
Language : English
Location : UK
Re: Disabling text selection/highlighting
Opera apparently doesn't support it because I added this property earlier as well but it didn't work. Also, I performed the IE edit, but as I have IE8, it might not show. Then again, IE is so unpopular that I believe people usually go for Mozilla or better.
Anyway, thank you! You helped a lot!
EDIT: Alright, I just learned that highlighting is disabled in IE9, so the edit was successful.
Anyway, thank you! You helped a lot!
EDIT: Alright, I just learned that highlighting is disabled in IE9, so the edit was successful.
teshrin- New Member
- Posts : 4
Reputation : 0
Language : Estonian
Location : Tartu
Re: Disabling text selection/highlighting
Topic Solved & Locked |
Sanket- ForumGuru
- Posts : 48766
Reputation : 2830
Language : English
Location : Mumbai
Similar topics
» Slow link hover highlighting
» Content Selection Code is not working?
» Coming soon: highlighting the importance of the forum title and description.
» Selection
» Change the selection color
» Content Selection Code is not working?
» Coming soon: highlighting the importance of the forum title and description.
» Selection
» Change the selection color
Page 1 of 1
Permissions in this forum:
You cannot reply to topics in this forum