I'm building an iOS website, and I'm trying to get the recently copied image using JavaScript.
When you hold your finger on a photo in a website a menu will pop-out with the option to Save the image or Copy. When you press copy and paste it later in a text-field, you can get the URL with:
pasteEvent.clipboardData.getData('text/uri-list');
When you copy an image in the camera roll, facebook application, or by selecting and you go to the same text-field (or textarea) the paste option is not available, however when going to the Mail.application the Paste option is available and pasts the image. So does anyone have a clue how to get the URL or binary data for a copied photo on an iPad?
Apple Documentation:
http://developer.apple.com/library/safari/#documentation/appleapplications/Conceptual/SafariJSProgTopics/Tasks/CopyAndPaste.html
Example:
http://codebits.glennjones.net/editing/getclipboarddata.htm
This won't be possible for a website to do, as the javascript won't have direct access to any native elements.
if however, you are hosting a webview in a native application, a-la phonegap ... then you may be able to do something here by handling the paste in native code, and then making it available to the webview.
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