javascript - Deselecting DIVs (or textboxes) content after being selected by user -


i prepare javascript-based system deselect text after user selects it. reason protect articles on site being stolen pressing ctrl+c pair. know it's possible omit it, it's @ least little harder. more, can't use jquery while writing script. suggest?

my advice not bother. javascript can disabled or manipulated using script console, source can viewed , copied, etc. if going steal articles won't able stop them without taking proper legal routes. what's more, you're inconveniencing folks have genuine need copy , paste something, quote or search term.

that being said, ie, chrome , safari support onselectstart event, cancellable:

element.onselectstart = function () { return false; } 

firefox supports own css style, -moz-user-select, give appearance text isn't selected, doesn't disable completely:

#element {     -moz-user-select: none; } 

for firefox, opera , other browsers, however, there's no solution other cancelling mousedown, double click , key events. there no way of capturing , blocking "select all" browser's menu.


Comments

Popular posts from this blog

asp.net - repeatedly call AddImageUrl(url) to assemble pdf document -

java - Android recognize cell phone with keyboard or not? -

iphone - How would you achieve a LED Scrolling effect? -