WebKit on th iPhone:可以使用JavaScript将文本复制到clipboad [英] WebKit on th iPhone: is it possible to copy text to the clipboad with JavaScript

查看:169
本文介绍了WebKit on th iPhone:可以使用JavaScript将文本复制到clipboad的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

iPhone 3.0软件添加了复制/粘贴,本机应用程序可以通过编程方式将内容复制到剪贴板。是否可以执行相同的操作,即从iPhone上的Safari内部运行的JavaScript代码将文本复制到剪贴板?

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 clipboard, from JavaScript code running inside Safari on the iPhone?

推荐答案

在桌面上,复制/粘贴到网站通常似乎使用嵌入式Flash小游戏;显然在iPhone上是既不可能也不可取。您可以尝试在Nick Dalton的演示文稿中讨论的 webView:shouldStartLoadWithRequest:navigationType:技术之一此处将信息从您的网络视图中拉出,然后调用相应的 UIPasteboard 方法。

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.

编辑:我的歉意没有正确地阅读这篇文章。如果它在主要的Safari应用程序,而不是一个 UIWebView 你控制,我不认为有办法强制复制。 Glyphboard (网站仅适用于非桌面Safari浏览器)是网站的一个示例,可能会制作使用此功能(如果存在)。

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.

这篇关于WebKit on th iPhone:可以使用JavaScript将文本复制到clipboad的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆