tags:

views:

55

answers:

3

Env: jQuery, richfaces

We would like to disable copying (using CTRL+A) sensitive information on certain pages and pasting via the clipboard. We would rather expect the user to use few buttons to export the data. How do we achieve this?

+4  A: 

You cannot. It is the user's computer and they can copy any data that they can see.

Now you can annoy the hell out of them by having some JavaScript that intercepts keys like Control-A and Control-C, but I hate that so much that I'm not going to tell you how to do it. You can downvote me all you like!

I suppose a nice middle ground would be to detect when the user tries to copy and not disallow it, but display some kind of a message along the lines of "Hey, are you trying to export the data? Try the Export button over there ->"

Evgeny
+2  A: 

That's the third question in a row which is about to "prevent" or "disable" some basic functionalitys.

You might think about User experience and usability.

update

You mentioned in your comment that you're dealing with sensitive data. I agree with the other comments that you should not send such sensitive data to the client. There is just no way to protect it.

jAndy
we have some sensitive information which we wouldn't want the user to copy and take a print out. wouldn't that be a valid use case?
@user339108 if it's so sensitive information, don't send it to client side.. cause even javascript is not a sure way to prevent them in getting it...
Reigel
@user If it's that sensitive, **don't let the user see it**. As soon as it's on the users computer, it's out of your hands!
deceze
+1  A: 

Pen and paper are still not deprecated.

Then there are screen capture tools, cameras, etc.

And there is always the human memory.

Finally, a browser is just a convenience which is not even needed. Someone can just curl in a http(s) request with whatever headers and/or data your server is expecting. No browser, no DOM, no events, just plain text on the command line. How do you control that?

Anurag