使用Greasemonkey获取剪贴板内容 [英] Get clipboard contents with Greasemonkey
问题描述
是否有可能让剪贴板的文本内容自动粘贴到textarea中点击按钮?刚刚找到了一种方法来复制数据,但没有从中读取数据。
Is there the possbility to get the textual content of the clipboard to paste it automatically into a textarea clicking a button? Just found a method to copy data to it, but not to read data from it.
推荐答案
不,你不能在javascript 中这样做,因为它已被证明是一个巨大的安全漏洞。
同样,Greasemonkey的开发者是由于同样的原因,不太可能添加此功能。
No, you cannot do this in javascript because it has proven to be a huge security hole.
Likewise, the developers of Greasemonkey are unlikely to add this capability for the same reasons.
你可以编写一个Firefox附加组件,但是我从未见过(合法的)用例。
You can write a Firefox add-on that does this, but I've never seen a (legit) use case.
对我来说效果很好的一种技巧是将Greasemonkey脚本设置焦点设置为textarea(或输入)然后我只按 Ctrl V 。它非常方便,实际上比抓住鼠标单击按钮更快。
A technique that works well for me is to have the Greasemonkey script set focus to the textarea (or input) and then I merely press CtrlV. It's super convenient and actually faster than grabbing the mouse to click a button.
这篇关于使用Greasemonkey获取剪贴板内容的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!