I was wondering if in chrome code we have some better way to detect when the user selects/highlights something in the current page than listening for keyup
/mouseup
and checking window.getSelection()
. Any ideas?
edit: Actually, what I'm trying to do is simply preventing the user from selecting any text at all in the contentDocument. Something that accomplishes this will be fine as well. (The idea behind getting the selection event was just to preventDefault()
or otherwise getSelection().removeAllRanges()
)
edit2: Please note that I need not just to prevent the highlighting from showing up, but rather the selection from happening.
edit3: I don't need to prevent copying but rather selecting the elements.