I am trying to disable copy option for certain part of my webpage. I know that there is no way to disallow user to copy if he sets his mind to it but I just don't want a simple copy of certain section to not work (select + right click or ctrl+c) to work.
Is there a way to achieve it?
I am trying to disable copy option for certain part of my webpage. I know that there is no way to disallow user to copy if he sets his mind to it but I just don't want a simple copy of certain section to not work (select + right click or ctrl+c) to work.
Is there a way to achieve it?
Share Improve this question asked May 4, 2018 at 6:07 learnerlearner 1,9828 gold badges34 silver badges65 bronze badges1 Answer
Reset to default 12You can add the following styles to prevent the user from selecting the text superficially like so:
user-select: none;
p {
user-select: none;
}
<p> Some sample text that you cant select </p>
Details on MDN