iPhone上的WebKit:是否可以使用JavaScript将文本复制到剪贴板

WebKit on th iPhone: is it possible to copy text to the clipboad with JavaScript(iPhone上的WebKit:是否可以使用JavaScript将文本复制到剪贴板)
本文介绍了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将文本复制到剪贴板的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持编程学习网!

本站部分内容来源互联网,如果有图片或者内容侵犯您的权益请联系我们删除!

相关文档推荐

Pushing UIViewController above UITabBar(将UIView控制器推送到UITabBar上方)
java.lang.IllegalStateException: SimpleTypeImpl should not be created for error type(异常:不应为错误类型创建SimpleTypeImpl)
userContentController never called back from JS injection(用户内容控制器从未从JS注入回调)
Android IllegalArgumentException: The tag for fragment_XXX is invalid. Received: layout-sw600dp/fragment_XXX_0(Android IlLegalArgumentException:Fragment_XXX的标签无效。收到:Layout-sw600dp/Fragment_XXX_0)
iOS convert audio sample rate from 16 kHz to 8 kHz(IOS将音频采样率从16 kHz转换为8 kHz)
Enforcing an audio sampling rate in iOS(在iOS中强制音频采样率)