How can I disable highlighting in html or JS?

后端 未结 7 1940
太阳男子
太阳男子 2020-12-13 19:24

I need to disable the highlighting of selected text on my web app. I have a good reason for doing this and know that this is generally a bad idea. But I need to do it anyway

7条回答
  •  不知归路
    2020-12-13 20:21

    If your ultimate goal is to make copy and paste of text more difficult, Javascript and CSS are not the right technology because you cannot disable the browser's view-source function.

    Some other ideas (none of them ideal):

    • a java applet (you control both display and retrieval of text)
    • same in a different browser plugin (flash, silverlight, etc.)
    • server-side created images (poor performance)

提交回复
热议问题