本文介绍了与JavaScript的Firefox插件交互的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我的情况是,当用户按f10我想在Firefox中运行复制粘贴插件。的情况下,我想实现这个键的监听器,当这个键按下运行插件和复制文本到剪贴板。
如何使用Firefox的插件通过JavaScript复制文本?
解决方案
这将文本复制到本机剪贴板。不是逻辑剪贴板。显然这些是不同的东西。
var gClipboardHelper = Components.classes [@ mozilla.org/widget/clipboardhelper; 1] .getService(Components.interfaces.nsIClipboardHelper);
gClipboardHelper.copyString(请把我放在剪贴板上)
My case is when the user press f10 i want to run the copy paste addons in Firefox.in the case i want to implement a listener for this key and when this key pressed run the addons and copy text to the clipboard.How i can use the Firefox addons to copy the text by javascript?
解决方案
This copies text to the native clipboard. Not logical clipboard. Apparently those are different things.
var gClipboardHelper = Components.classes["@mozilla.org/widget/clipboardhelper;1"].getService(Components.interfaces.nsIClipboardHelper);
gClipboardHelper.copyString("Put me on the clipboard, please.")
这篇关于与JavaScript的Firefox插件交互的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!