Html5 - Read The Clipboard?
Solution 1:
Perhaps the HTML5 Core spec doesn't provide an API for accessing the clipboard, but one of the APIs in the HTML5 family of APIs does. It's called "Clipboard API and Events," and its currently (as of July 2011) a Working Draft. You can find the spec here:
http://www.w3.org/TR/clipboard-apis/
As for implementations, well, I couldn't find one just yet.
Update: As of Dec 2012, this API is still a working draft (dated Feb 2012). There still do not appear to be any working implementations, just a Flash-based workaround for text.
Solution 2:
Yes you can use pure JavaScript for this, assuming a modern browser that implements the Clipboard API such as Google Chrome.Chrome Frame is available for IE support and I assume that Firefox will implement the Clipboard API fairly soon. You can only read clipboard data from paste events (such as Ctrl+V
), but from that you can read binary data such as image data.
HTML Clipboard API jQuery Plugin and demo. This demo requires the Chrome browser.
Solution 3:
No, there is no built-in API for accessing the clipboard. BUT you can use https://github.com/mojombo/clippy for accessing the clipboard. It's flash not Java, so it should be ok for you to use. The advantage is it works across all flash-capable browsers.
Post a Comment for "Html5 - Read The Clipboard?"