Will there ever be an HTML5 Clipboard API? [closed

2019-03-12 02:08发布

问题:

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?

回答1:

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.



回答2:

this is just a support for html5 to allow setting clipboard with string data or other data on request from user. I'm not for screen capture into clipboard