DEV Community

Cover image for Preventing copying text in a webpage 😁

Preventing copying text in a webpage 😁

Rahul on November 06, 2020

This feature is really important if you have a very very unique content website or an online eBook. So here is the basic post and required post for...
Collapse
 
shrihankp profile image
Shrihan

Well, I can copy using DevTools πŸ˜‚
Nice article, though πŸ‘

Collapse
 
rahxuls profile image
Rahul

Cheater😁

Collapse
 
amgedalmogahed profile image
AmgedAlmogahed

Google lens can copy any text any where

Collapse
 
rahxuls profile image
Rahul

Found the second cheater.

Collapse
 
wannabehexagon profile image
ItsThatHexagonGuy

Pretty sure that this also makes the content inaccessible

Collapse
 
rahxuls profile image
Rahul

Yea it will maybe.

Collapse
 
patarapolw profile image
Pacharapol Withayasakpunt • Edited

Whatever you may try, one can always use Puppeteer, DevTools or View Page Source.

However, I would want to send signals to say, you are not intended to copy, unless you want to break the law. (And disable easy-copying, without breaking a11y, e.g. tab.)

Collapse
 
rahxuls profile image
Rahul

Hahaa yea.

Collapse
 
janpauldahlke profile image
jan paul

user-select: none ?

Collapse
 
rahxuls profile image
Rahul

Yea simple. (See the browser support too brother)

Collapse
 
janpauldahlke profile image
jan paul

i use css shims for this :-)

Thread Thread
 
rahxuls profile image
Rahul

amazing.

Collapse
 
aayushidroid profile image
Aayushi Sharma

I think we can access content using Request module.

Collapse
 
rahxuls profile image
Rahul

I found the 4th cheater.

Collapse
 
shrihankp profile image
Shrihan

This is also identical to using, say, cURL or HTTPie.
I cheated two timesπŸ™„πŸ˜‚

Thread Thread
 
rahxuls profile image
Rahul

I'm requesting the Dev community to ban you πŸ˜‚πŸ˜‚πŸ˜‚πŸ˜‚

Collapse
 
adam_cyclones profile image
Adam Crockett πŸŒ€

It's better to choose a correct license I promise there is no merritt to any of the above techniques. Get the LAW on your side.

Collapse
 
rahxuls profile image
Rahul

Ahh!! 🀣

Collapse
 
adam_cyclones profile image
Adam Crockett πŸŒ€ • Edited

πŸš¨πŸš” DMCA anyone who dares oppose your IP

Collapse
 
wweiss profile image
William Weiss

So I tried the example in my favorite browser, curl, and had no problem copying...

Collapse
 
masiota profile image
Mahmoud AlSharif

Thanks for sharing!
There is also more robust solutions like rendering text within the canvas or even better transform the text to SVG in the backend.

Collapse
 
oliverobenland profile image
Oliver Obenland

On mobile I can copy like usual (iPhone)

Collapse
 
rahxuls profile image
Rahul

Third cheater.

Collapse
 
zogamnuam profile image
zogamnuam

I thought we only did that back in 2004,2005 or so. Is it cool again now? :-)

Collapse
 
rahxuls profile image
Rahul

Hope it would be

Collapse
 
steinbring profile image
Joe Steinbring

CTRL+A ... CTRL+C πŸ–οΈπŸŽ€

😁

Collapse
 
taufik_nurrohman profile image
Taufik Nurrohman

You can also ask the copier to add attribution link to the copied text β†’ github.com/taufik-nurrohman/sticky...

Collapse
 
piyush_kash profile image
Piyush Kashyap

bt "don't fuck with paste" will still do the job right?!

Collapse
 
rahxuls profile image
Rahul

Dk

Collapse
 
piyush_kash profile image
Piyush Kashyap

try then