

Ask HN: When will clipboard support finally come to browsers? - sgehlich

I&#x27;m working on a project where automatic copy &amp; paste would come in very handy. A simple Clipboard API with Clipboard.set and Clipboard.get would be awesome - but browser simply don&#x27;t support it yet - not even Webkit!<p>I read a lot about security concerns, but seriously, we are already able to record the microphone and webcam using JavaScript with the user&#x27;s approval. Why isn&#x27;t there any way to do the same for the clipboard?<p>Thanks in advance for your answers :)
======
joshstrange
Well the security concerns are VERY valid, in theory after getting your
permission to access the clipboard I could poll it every X milliseconds and
fire off whatever I get to a third-party service. If you look at Flash's
implementation for getting data from the clipboard[0] you can see they mention
all sorts of limitations like "Because of security restrictions on accessing
clipboard data, this example does not work in Flash Player. In Flash Player,
you can only call the getData() method of the Clipboard object in a paste
event handler.". I can see there being support possibly for setting the
clipboard via JS but I'm struggling to find a good reason to want to get the
clipboard data? Why not have the user just paste it in a textbox and listen
for on change or something like that?

[0]
[http://help.adobe.com/en_US/FlashPlatform/reference/actionsc...](http://help.adobe.com/en_US/FlashPlatform/reference/actionscript/3/flash/desktop/Clipboard.html#getData\(\))

~~~
sgehlich
Okay, good point on getting the clipboard data. But what about setting it? I
don't see a big security concern there.

Also, what if the user has to give permission to read the clipboard per
default, but he can also check 'Always allow for this tab'?

~~~
yogo
No thanks. I definitely don't want a site to have the ability to set my
clipboard. It will be much easier to help spread malicious links (visiting a
site using paste and go). Plus what about the annoyance of having something in
your clipboard that you were going to paste somewhere then due to visiting
another site it gets wiped?

