Is it possible with HTML 5 to read the clipboard (without using Java)?
Look for a clipboard icon in the top toolbar. This will open the clipboard, and you'll see the recently copied item at the front of the list. Simply tap any of the options in the clipboard to paste it into the text field. Android does not save items to the clipboard forever.
This is because websites scripts can erase and replace what you currently have in your clipboard (data loss issue) and they can read whatever you have in your clipboard (security and privacy issue); as such, you should grant access with caution.
Smart buttons that allow you to copy URL's directly from the search bar to the clipboard How to Use: 1. Highlight the text you wish to copy. 2. Right click and select "Copy" or press on CTRL+C (Windows) / CMD+C (MAC).
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.
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.
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.
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