会有 HTML5 剪贴板 API 吗? [英] Will there ever be an HTML5 Clipboard API?

查看:20
本文介绍了会有 HTML5 剪贴板 API 吗?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我对我们在剪贴板访问方面落后于其他标准 Web API 的程度感到沮丧.

我正在开发一个网络应用程序,让您可以在浏览器中绘制和编辑 SVG 图形.File API 让我可以完全在客户端加载和读取 SVG 文件,而 SVG API 显然可以让我显示 SVG 图形.

但是,不可能像在 Illustrator 中复制某些内容一样,从浏览器中获取我绘制的任何内容并将其粘贴到 Photoshop 中.

W3C 以安全为由否认操纵复制事件的能力:

<块引用>

使作者能够更改用户复制的内容,或制作从未选择并允许的东西的自动复制不受限制地调用粘贴信息可以提高各种安全性和隐私问题.

问题的一个示例场景是用户选择一个链接并复制它,但另一个链接被复制到剪贴板.效果其中的范围可以从粘贴时的意外结果到尝试网络钓鱼"攻击.

来源:我有些希望.例如,我非常喜欢我在 imgur 上可以用它做的事情.(尝试在您的操作系统中复制图像并将其粘贴到 imgur 的主页上).

我所描述的内容是否有可能被复制?它正在处理中吗?

解决方案

优秀的帖子.+1 我想看看这个应用程序.但我认为您已经用所有文档回答了您自己的问题.

您应该向 WHATWG 提出请愿,因为您所说的似乎是一个很好的解决方案,而且他们(WHATWG)似乎并不希望创建此标准,因为担心剪贴板转储以捕获(可能)敏感的用户数据.

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?

解决方案

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.

这篇关于会有 HTML5 剪贴板 API 吗?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆