3

How can I get access to the iPhone clipboard whilst using PhoneGap? I cannot see support in their docs so wonder if there is another way I can gain access?

Chris
  • 26,744
  • 48
  • 193
  • 345
  • You can do it with Javascript, with or without JQuery. See http://stackoverflow.com/questions/3475293/copy-and-paste-clipboard-in-javascript-or-jquery – Diego Mar 25 '12 at 20:08
  • Thanks for the answer but this seems to be a Mozilla only solution and the jQuery plugin requires flash, which isn't on the iPhone – Chris Mar 25 '12 at 20:10

3 Answers3

6

There's a ClipBoard plugin that you can try: https://github.com/phonegap/phonegap-plugins/tree/master/iPhone/ClipboardPlugin

Note that this plugin supports copying and pasting only text and no other data types right now.

Vicenç Gascó
  • 1,326
  • 2
  • 13
  • 21
  • 1
    Thanks - I had literally just found this as you posted. P.s. any idea how to extend this for images? – Chris Mar 25 '12 at 20:29
  • 2
    U're welcome. I'm not sure how to extend it for images, but if you have access to objective-c code, just use the `NSPasteboard* pasteBoard = [NSPasteboard generalPasteboard];`, then you can get the content with: `image = [pasteBoard dataForType:NSTIFFPboardType];`. – Vicenç Gascó Mar 25 '12 at 20:36
  • 2
    404, what is the preferred approach in 2013? – Blowsie Nov 22 '13 at 16:44
  • page not found on github – z22 Mar 03 '14 at 04:51
2

This seems to be the current plugin for this functionality:

https://github.com/VersoSolutions/CordovaClipboard

ericpeters0n
  • 668
  • 7
  • 12
1

Link does not work. I found this other question more useful

Copy to Clipboard with javascript for phonegap

Community
  • 1
  • 1
Marcom
  • 4,621
  • 8
  • 54
  • 78