0

There were some discussion in the past about disabling highlighting some parts of the selected text in Web pages, so the user is not able to visually select them (e. g. How to disable text selection highlighting using CSS?).

But they are still selected when the user selects it (e. g. with the adjacent text without the anti-highlighting protection).

So he or she press Ctrl+C to be surprised - the text in the clipboard is different from the selected one.

Is there some way to exclude a non-highlighted text from the selecting it, too?


Edited:

This problem manifests itself only in Chrome browser, other browsers don't select non-highlighted text (thanks to evolutionxbox) so my question is now:

How reach my goal for Chrome, too?

MarianD
  • 13,096
  • 12
  • 42
  • 54
  • Are you using https://stackoverflow.com/questions/826782/how-to-disable-text-selection-highlighting-using-css#answer-4407335 solution? – Morpheus May 22 '17 at 15:31
  • @Morpheus OP's issue is still prevalent even when using `user-select`. – evolutionxbox May 22 '17 at 15:32
  • the most upvoted answer on the question you linked seems to do exactly what you're after ? https://stackoverflow.com/questions/826782/how-to-disable-text-selection-highlighting-using-css – andrew May 22 '17 at 15:33
  • @andrew you can still copy and select text if the adjacent text is not "protected". – evolutionxbox May 22 '17 at 15:34
  • @evolutionxbox probably depends on the browser. The most upvoted answer works fine for me on Chrome. – Morpheus May 22 '17 at 15:34
  • @Morpheus what browser are you using? http://jsbin.com/neqetuvori/edit?html,css,output – evolutionxbox May 22 '17 at 15:38
  • @evolutionxbox yup, now I can see the problem. – Morpheus May 22 '17 at 15:41
  • @evolutionxbox - It works fine in Firefox, but in Chrome 58.0.3029.110 (64-bit) it still selects (and copies) "protected" text, too. – MarianD May 22 '17 at 16:19
  • @MarianD I know. That's my jsbin link shows. – evolutionxbox May 22 '17 at 16:20
  • @evolutionxbox - Oh, I mistakenly reacted to Morpheus 1st comment ("works fine for me on Chrome"). In spite of it your link was valuable for me as I found out that in Firefox it works fine. (Previously I worked only with Chrome and I didn't tested my code in other browsers as I naively supposed that Chrome is good enough.) – MarianD May 22 '17 at 16:34

0 Answers0