I am sending sensitive information to my users that I would like them to be able to copy (for pasting elsewhere) but not see directly.
There are a few approaches I have considered, and I am stuck on all of them.
-
Populate an password box with the data, but this doesn’t allow
them to copy the text. -
Make the text color the same as the background color. However, I
am afraid that my users will not even know that there is text to
copy. They will just sit there and go “I don’t see a any text!” Even
if I do point out very explicitly what they are supposed to do, then
the text will still be visible when it is selected. -
Create some kind of on_copy event that will pass the text when a
user copies the asterisks. I know how to use jQuery’s bind() to
detect a copy, but I have not found a way to change what actually
gets copied. -
Last and least: Something fancy with javascript and clipboard
management. I really don’t want to go there as it would require
flash.
How about this… you make a
divorinputcontaining the “hidden” text withopacity 0.001,focus()it and set it’s selection on the whole content (which should be the text you want the person to copy) via javascript and somehow inform the user to pressCtrl+Cto copy the data (possibly with an javascript popup-like event that stays there for a few seconds for the user to read it).