如何在HTML5中管理从剪贴板粘贴的图像? [英] How to manage image pasting from clipboard in html5?

查看:99
本文介绍了如何在HTML5中管理从剪贴板粘贴的图像?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在Documentum Eroom应用程序中,IE能够自动从剪贴板粘贴上传图像,而Firefox不能。

所以我不知道html5是否支持这种行为不仅仅是从资源管理器拖放图像/文件)。

更新:授予访问权限还不够,它还能够处理BINARY数据而不仅仅是TEXT当前的firefox可以处理二进制文件我看不到它可能它不是显式的?

它不是简单的拖放操作,而是在许多网站上广泛使用。它是关于BINARY FORMAT CLIPBOARD MANIPULATION的,用于将图像从剪贴板保存到服务器,无需保存文件,然后拖放。将文件保存在某个地方的过程对于用户来说是非常艰巨的,所以直接从剪贴板上传文件实际上是一种节省时间的方法。

,HTML5具有这种能力,并且正在得到广泛的实施。您可以处理来自Ctrl + V的事件并获取二进制图像数据并根据您的需要做任何事情。



目前Google Chrome 13.0.782.220的效果很好。我有一个jQuery插件和一个完整的演示说明了这个功能(一定要使用谷歌浏览器,我不能保证它的其他浏览器)

http://strd6.com/2011/09/html5-javascript-pasting-image-data-in随着robertc提到剪贴板API规范正在变得标准化,所以它应该能够在浏览器上尽快采用。

On Documentum Eroom App, IE is capable of automatically uploading image from clipboard pasting whereas Firefox can't.

So I wonder if html5 supports that kind of behavior (not just drag and drop of image/file from explorer).

Update: granting access is not enough it's also about being able to handle BINARY data not just TEXT does current firefox can handle binary I can't see it maybe it's not explicit ?

It's not about just drag and drop which is widely already implemented on many sites. It's about BINARY FORMAT CLIPBOARD MANIPULATION to save the image from the clipboard to the server without any need to save file and then drag and drop. The process to save the file somewhere is extremely daunting for user so direct uploading from clipboard is really a must time saver.

解决方案

Yes, HTML5 has this capability and it is becoming widely implemented. You can handle events from Ctrl+V and get binary image data and do whatever you want with it.

Currently Google Chrome 13.0.782.220 works great. I have a jQuery plugin with a full demo illustrating the feature (be sure to use Google Chrome, I can't guarantee it other browsers)

http://strd6.com/2011/09/html5-javascript-pasting-image-data-in-chrome/

As robertc mentions the Clipboard API spec is becoming standardized, so it should lead to adoption across browser soon enough.

这篇关于如何在HTML5中管理从剪贴板粘贴的图像?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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