# Block text from being copied

Staff Emeritus
Gold Member
Say you have a website with mainly text, but that you want people not to be able to just "copy-paste" from it.

Is there a way to make the browser:
1. Download the content as text (so that the speed stays ok),
2. Display it normally, but
3. Block any user from selecting a portion of it (so that he cannot copy it into another application)
???

Related Computing and Technology News on Phys.org
ahrkron said:
Say you have a website with mainly text, but that you want people not to be able to just "copy-paste" from it.

Is there a way to make the browser:
1. Download the content as text (so that the speed stays ok),
2. Display it normally, but
3. Block any user from selecting a portion of it (so that he cannot copy it into another application)
???
Nope, no way to make your website content completely safe. If someone wants to store it or copy it there is no sure protection. Sorry

chroot
Staff Emeritus
Gold Member
Well, you could potentially use a Java applet to display the secure content. You could make it pretty damn difficult to copy and paste it that way.

Of course, in the end, it's all just bytes over a network connection, and anyone with enough sense can look at those bytes. Using some kind of cryptosystem will make the content difficult to copy -- but never, never impossible.

- Warren

Staff Emeritus
Gold Member
Thanks guys,

Actually, I don't need all the way to "impossible". "Kind of hard" would be good enough. Some friends of mine are putting together a site for homework help in Spanish, and they want the kids to be forced to at least type the answers once (or look it up by themselves, which would be equivalent to doing the homework). What can be done for this? Any web references, or code snippet that could be used?

enigma
Staff Emeritus
Gold Member
Could you make the pages be .pdf's, or does the size become to large to handle then?

Staff Emeritus
Gold Member
They started making png's out of the text (with "watermarks" behind the text), but it doesn't quite cut it.

Is there a way to make the browser:
1. Download the content as text (so that the speed stays ok),
2. Display it normally, but
3. Block any user from selecting a portion of it (so that he cannot copy it into another application)

This code disables all clicks from the user of your site:

<script language="javascript">

// No click script

function click() {

if (event.button==1 || event.button==2) {

}

}

document.onmousedown=click

</script>

NateTG
Homework Helper
Except for those of us who know how to turn off javascript.

Oh wait, that's too easy, let's take a screen shot instead. If you can't handle giving out images, odds are you can't handle distributing the material in any format.

Staff Emeritus
Gold Member
It is not an "on-off" thing. The smaller the download size, the better.

Except for those of us who know how to turn off javascript.
Can you suggest a better solution?

ahrkron, maybe you can do something to your site in which you have to have javascript enabled to make it work.

Disabling all clicks stops them from right-clicking/copying, or being able to highlight and select text completely.

It's your best bet while displaying the site normally you can block most users from displaying the text.

chroot
Staff Emeritus
Gold Member
Listen guys, forget the browser. You can spend all your time trying to make people's browsers not allow things, but who cares? Anyone with half a brain will type:

telnet server.com 80
GET /page.html HTTP/1.0

and be done with it. No browser needs to be involved. Or the user can use his browser's view source feature. Or he can use a packet sniffer to dump all the IP traffic, and read the bytes from that.

Bottom line, if the bytes go across the network unencrypted, they can be captured by anyone with more than a dozen neurons.

You could use https to prevent people from capturing packets off the network, but then you have to deal with the security limitations of the browser. Hence, you make a Java applet, or a custom program, that does its own decryption.

It still doesn't prevent the user from taking a screen shot of it.

- Warren

Even if there were a way to copy-protect the text, It still would be pretty easy to copy it: Just take the page and hit Print Screen on the keyboard and paste it onto Paint and save it as an image.

Even if there were a way to copy-protect the text, It still would be pretty easy to copy it: Just take the page and hit Print Screen on the keyboard and paste it onto Paint and save it as an image.
Chroot and NateTG have already mentioned the "screen shot" problem before, no need to mention it for a 3rd time.

Would you rather them be able to freely copy and paste?

His problem was that he didn't want users selecting portions of text on his website - so the most logical thing to do is disable clicks.

Hide text that is the same color as the background and use that as spaces. For instance if I was going to do this, I'd say:

The<FONT COLOR ="white">X<\FONT>answer<FONT COLOR ="white">X<\FONT>to<FONT COLOR ="white">X<\FONT>the<FONT COLOR ="white">X<\FONT>question.

here's what the above would look like when rendered by Safari (to heck with MS). Cut and paste to see what I you get.

There is a slightly larger gap between 'The' and 'answer' because I squeezed two characters in ther. You can fiddle with the font size of the two characters to make them look like one character.

In the above, the 'X' would not show if the background color was white, but it would show if the student simply cut and pasted. You can hide a few marks like this to indicate if the cut and paste was used. Purposly miss spell selected word using the hidden words as indicators. I wouldn't recomment filling every blank as I did, but one or two blanks would be enough to show if the cuts and pasts are going on. If you do the above, use courier font if you can because each character, including spaces, occupies the same width. Also, you can set the font size between one of the gaps to 6 which would allow you to put a space and a character in the same space as a font size 12 would occupy. People usually miss the single characters mistakes.

Hopeful I explained this well enough. I'm a little tired thus my ability to express myself is less than optimal.

You wont stop cutting and pasting but you'll be able to catch them in the act. Warn the kids the first day of class. Bring their names up the first time they get caught doing it to the entire class. "Johnny, you might try typing in the assignment as I said not cutting and pasting." This lets them know you can catch them. yadda-yadda-yadda...

As far as disabeling clicks, you can do it pretty easily, but you can get around that just as easily.

EDIT: Argh!!! fixed my AFU HTML example.

Last edited:
Staff Emeritus
Gold Member
chroot said:
Listen guys, forget the browser. You can spend all your time trying to make people's browsers not allow things ... Anyone with half a brain...
Think of the context. I agree that some kids will still be able to get around any protection, but the site is for help for kids from 6 yo on; for sure, most of them won't be able to do a telnet + get.

motai said:
... hit Print Screen ...
They thought about this. Can be easily solved with a graphic background with a logo and saying "Taken from such website". This of course can also be overcome, but again, most kids won't know about graphic filtering, color histogram editing, etc.

Also, the tips and answers provided are often short enough to make it easier to retype than to "process".

faust9:

Good idea! Thanks.

Anyway, does anybody know any other ways to make text-copying even slightly difficult?, besides the ones already mentioned?

Thank you all.

Last edited:
dduardo
Staff Emeritus
I think the best way is to have a picture with some type of background, preferable alternating light gray and dark gray dashed grids across the picture. This way if you do a print screen and run the image through OCR the program will have trouble converting the picture into plain text. You also want to bleed the grids into the text in a way so it is readable, but you can't just take the picture into photoshop and use the magic wand to select the grid and delete it.

Nereid
Staff Emeritus
Gold Member
I think faust9 is on the right track ... rather than try to prevent it, set it up so catching it is easy. Your purpose is probably more to do with encouraging 'proper' behaviour and good learning styles than setting technical hurdles (whose defeat may be an irresistable challenge to some).

As always in teaching, knowing your students well is best for your own pedagogical objectives (and, hopefully, their educational experience ), so it's better that you know what's going on (and they don't). One problem I've seen is the 'help' which some students get, from siblings, friends, parents ... (may not be relevant at all for you).

In addition to faust9's double spaces, you could add unicode characters which look all the world like English letters but aren't, an occassional (double) quote mark for an apostrope, ...

Also, to add onto my idea, you could write a program that would allow the teacher to enter the sentence he/she wants and the script would then automatically generate HTML code with random letters shoved into the spaces. The HTML program would be pretty easy to write thus making the whole process much easier. If you can run a PHP server life could be made even easier. You, or someone, could develop a PHP script to parse sentences for spaces and then insert random characters each time the particular sentence is downloaded. PHP is server side so you can set up a simple txt format data base of sentences and the PHP will do the rest. By inserting random characters each time the sentence is loaded to the browser you make it tougher for one student to tell another student which characters to remove. Also by inserting random characters into every space you will end up forcing the student to read the sentence and analize each word to find the offending characters anyway. The system is easy to figure out but hard to get around because the work is being done on the server rather than the student's computer. Cutting and pasting would be easy but removing the offending characters would be cumbersom. I wouldn't use numbers as the random characters because numbers would stick out while lower case letters would probably blend in fairly well.

One way to crack this would be to use a script to parse the HTML code for the <FONT COLOR="white">_someCharacterHere<\FONT> and simply replace this with a space. Students with a fair amount of programming experience could do this, but I dare say few would.

I think you know there are no ways to truely stop students from getting around this, or any system, but there are ways to discourage this. If the process is easily figured out but more burdensome to circumvent than simply doing what is required then most will end up doing what is required.

so why are you trying to destroy the internet anyway? if somethings so sensative that it cant be copied (and whats to stop someone from just screencapping, or writing it down by hand) then why are you dissamenating that information?

ahrkron said:
Thanks guys,

Actually, I don't need all the way to "impossible". "Kind of hard" would be good enough. Some friends of mine are putting together a site for homework help in Spanish, and they want the kids to be forced to at least type the answers once (or look it up by themselves, which would be equivalent to doing the homework). What can be done for this? Any web references, or code snippet that could be used?
I don't think what is being proposed is as dire as destroying the internet. I think ahrkron simply wants kids to work a little at learning Spanish while using the net as a tool to do so.

Staff Emeritus
Gold Member
kronchev said:
so why are you trying to destroy the internet anyway?
OMG!! How did you figure it out!?

This will make it so that they can't select the text:
Code:
<textarea disabled>Your text here</textarea>
Now if you wanted it to look just like normal text you would have some css on it like so:
Code:
<textarea style="border-style:none;resize:none;color:black;width:100%;height:100%;background-color:white;" disabled>Your Text Here</textarea>