View Full Version : Is it posible to have unselectable text?

09-28-2004, 09:32 PM
I would like to have a page that users cannot select the text and paste it in another document. I know this is ordinarily done using PDF but that isn't an option for me on this project. I have built a temp id card using html and I want the user to be able to print but not copy and paste. Can it be done???


09-28-2004, 09:54 PM

09-28-2004, 09:59 PM
I am using asp v.6 not .net. How would I go about changing the form to an image?

Roy Sinclair
09-29-2004, 07:40 PM
Consider using a page without the sensitive text on it for a "display" page while using a <link> tag to designate the "print" version page which will be called by the user's browser when they go to print. Make doubly sure the users don't bring the "print" page to their browser window by adding a CSS style sheet to the print page like this:

<style type="text/css">
@media screenl {body {display: none;}}

This can still be bypassed by the savvy user but it's going to take more work and there is just no way to completely prevent the user from copying anything they want.

09-29-2004, 09:53 PM
I like that solution, but for what it's worth, CSS generated content is not selectable either, as far as I know.

09-29-2004, 10:05 PM
A javascript event handler known as onselectstart could be used on the body tag:

<body onselectstart="return false;">

Though, javascript can be disabled. Your best bet is images. PHP can generate images, and I'm sure ASP and PERL can too, but I'd imagine it's not as easy...

Try the PHP forums if you're interested in that method. Otherwise, there will be a way around it.

Roy Sinclair
09-29-2004, 10:33 PM
Generating Images using ASP can be difficult, using .NET it's a snap. Since he states he has ASP but can't do .NET it's probable that PHP is out of the question too.

09-29-2004, 11:00 PM
Can it be done???If you send it in a text format, they can do what they like. If you send it any other way, they can just type it out.

Just like protecting images, if you don't want them to have it, don't send it to them.