2

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.

  1. Populate an password box with the data, but this doesn't allow them to copy the text.

  2. 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.

  3. 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.

  4. Last and least: Something fancy with javascript and clipboard management. I really don't want to go there as it would require flash.

j08691
  • 204,283
  • 31
  • 260
  • 272
calebtomlinson
  • 714
  • 1
  • 5
  • 8
  • 3
    Why would you ever "like them to be able to copy (for pasting elsewhere) but not see directly"??? – Sidharth Mudgal Oct 12 '12 at 20:17
  • 2
    Is this a security issue. If a user copies the text, they can just paste to notepad and see it, right? – Tom G Oct 12 '12 at 20:17
  • They are meant to copy the text and paste it into a password field on another site. It's their data. They can put it into a text editor if they would like, but they would have no reason to. – calebtomlinson Oct 12 '12 at 20:24
  • 2
    @SidharthMudgal to prevent others that look over the shoulder of the user to see the 'sensitive information', I'd guess. Like sending a password with a POST request rather than a GET request, because you don't want to show your password in the URL to someone who just accidentally passes by. – 11684 Oct 12 '12 at 20:27
  • Why not just have a "show in plain text" checkbox that toggles between displaying as input type=password and normal input? I've seen that on some user interfaces. – Martin Smith Oct 12 '12 at 20:59

1 Answers1

0

How about this... you make a div or input containing the "hidden" text with opacity 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 press Ctrl+C to copy the data (possibly with an javascript popup-like event that stays there for a few seconds for the user to read it).

xception
  • 4,241
  • 1
  • 17
  • 27
  • Opacity! Just the kind of idea that I was looking for. I am going to also make it select the text whenever they click in the box, and maybe try to find a way to add some more visual feedback so that they know what is selected. This will get me going in a direction that works. – calebtomlinson Oct 12 '12 at 20:52