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

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

问题描述

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 gizmo;显然在 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.

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

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