WebKit on th iPhone: is it possible to copy text to the clipboad with JavaScript

后端 未结 1 1342
名媛妹妹
名媛妹妹 2021-01-18 17:08

The iPhone 3.0 software added copy/paste, and native application can programmatically copy content to the clipboard. Is it possible to do the same, i.e. copy text to the cli

1条回答
  •  清酒与你
    2021-01-18 17:59

    On the desktop, copy/paste in websites typically seems to use an embedded Flash gizmo; obviously on the iPhone that's neither possible nor desirable. You might try one of the webView:shouldStartLoadWithRequest:navigationType: techniques discussed in Nick Dalton's presentation here to pull information out of your web view, then call an appropriate UIPasteboard method.

    edit: My apologies—didn't read the post correctly. If it's in the main Safari app as opposed to one whose UIWebView you control, I don't think there is a way to force a copy. Glyphboard (site only works from within non-desktop Safari) is an example of a site that would probably be making use of this functionality if it existed.

    0 讨论(0)
提交回复
热议问题