I'm frustrated with how far behind other standard web APIs we are with clipboard access.
I'm working on a webapp that lets you draw and edit SVG graphics in the browser. The File API lets me load and read an SVG file completely client-side and the SVG API obviously lets me display SVG graphics.
But it's impossible to get anything I draw out of the browser and paste it into, say, Photoshop, like you can when you copy something in Illustrator.
The W3C denies the ability to manipulate copy events on the grounds of security:
Enabling authors to change what is copied by a user, or to make an automated copy of something that was never selected and allowing unrestricted calls to paste information can raise various security and privacy concerns.
An example scenario of a problem is where a user selects a link and copies it, but a different link is copied to the clipboard. The effect of this can range from an unexpected result on pasting to an attempted "phishing" attack.
Source: http://www.w3.org/TR/clipboard-apis/#other-security-and-privacy-considerations
Yet geolocation, which is just as much of a security/privacy consideration, is being supported by the newest browsers with a simple permissions dialog.
Why can't we have the same thing for copying to the clipboard? It could even be restricted to require a CTRL+C event, to avoid abuse.
"so-and-so.com wants to control the data you're copying. [Allow] [Deny]"
Users could allow it once for a webapp they trust, and get more out of it forever. And developers could do more exciting things with the web.
The recent adoption of paste capturing gives me some hope. I absolutely love what I can do with this on imgur, for example. (Try copying an image in your OS and pasting it on the homepage of imgur).
Is there any chance of what I described becoming possible for copying? Is it being worked on at all?
The Clipboard API provides the ability to respond to clipboard commands (cut, copy, and paste) as well as to asynchronously read from and write to the system clipboard.
The async clipboard API is a powerful web API, capable of both writing arbitrary data to the clipboard, as well as reading from the system clipboard.
Excellent post. +1 I'd like to see the app. But I think you've answered your own question with all the documentation.
You ought to petition the WHATWG, as what you say seems to be a good solution and it does not appear that they (the WHATWG) wish to create this standard for fear of clipboard dumping to capture (possibly) sensitive user data.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With