如何在交叉浏览器中阅读剪贴板数据? [英] How to read clipboard data in cross browser?

查看:158
本文介绍了如何在交叉浏览器中阅读剪贴板数据?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述


可能的重复项:

使用FireFox,Safari和Chrome将文本复制/放入剪贴板

如何使用JavaScript将内容复制到剪贴簿?

您好,

方案:我复制了一些内容(从记事本或词)它在我的iframe。在粘贴之前,我想要操作剪贴板内容。
在IE中我可以使用 window.clipboardData.getData(Text);
如何读取其他浏览器中的剪贴板数据/ chrome和safari)

scenario: I copied some content (either from notepad or word) and want to paste it in my iframe. On before pasting i want to manipulate the clipboard content. In IE i can do it with window.clipboardData.getData("Text"); How to read the clipboard data in other browsers (FF/chrome and safari)

推荐答案

Firefox的版本

Incase of Firefox


默认情况下,由于安全和隐私权原因,JavaScript不允许
读取或设置剪贴板数据。这是
因为网站脚本可以擦除和
替换您当前在
您的剪贴板(数据丢失问题)和
他们可以阅读你在
你有什么你的clipboard(security and privacy
issue)

By default, JavaScript is not allowed to read or set your clipboard data for security and privacy reasons. This is because websites scripts can erase and replace what you currently have in your clipboard (data loss issue) and they can read whatever you have in your clipboard (security and privacy issue)

从这里

这篇关于如何在交叉浏览器中阅读剪贴板数据?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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