复制到也可以在移动设备上使用的剪贴板吗? [英] Copy to Clipboard that also works on Mobile?

查看:89
本文介绍了复制到也可以在移动设备上使用的剪贴板吗?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我熟悉ZeroClipboard和jquery.copy,它们都使用Flash.好的,我明白了,出于浏览器安全的原因,不允许复制,我们需要Flash.但这意味着复制功能不适用于手机(iPhone,Android)或iPad.

I'm familiar with ZeroClipboard and jquery.copy, which both use Flash. OK, so I get it, for browser security reasons, copying is disallowed and we need Flash. But this means the copying functionality does not work in mobiles (iPhone, Android) or iPad.

在现代浏览器(包括IE7 +)和移动浏览器上,是否有任何资源或插件允许简单的复制到剪贴板"功能?

Is there any resource or plugin that allows a simple Copy to Clipboard functionality on both modern browsers (include IE7+) and mobile browsers?

谢谢!

推荐答案

我只是想提供一个更新,因为这方面已有一些最新进展.除Safari之外,现代浏览器均支持使用execCommand()API通过JS复制.

I just wanted to offer an update, since there have been some recent developments on this front. Modern browsers, except for Safari support copying via JS, using the execCommand() api.

假设您构建的UI可以正常降级为Safari的手动复制,则可以在其余部分上实现复制到剪贴板".大概是Safari最终将包括对此的支持.

Assuming you build your UI to gracefully degrade to manual copying for Safari, you could implement copy-to-clipboard on the rest of them. Presumably, Safari will include support for this eventually.

查看 https://clipboardjs.com/截至撰写本文时,支持浏览器:Chrome 42 +,Firefox 41 +,IE 9 +,Opera 29 +.

Browsers supported, as of writing: Chrome 42+, Firefox 41+, IE 9+, Opera 29+.

这篇关于复制到也可以在移动设备上使用的剪贴板吗?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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