Answer the question
In order to leave comments, you need to log in
"Copy" function in Firefox
I am writing a custom script for greasemonkey. It is necessary to implement the function of copying text. Something the search did not give anything good. Tell me, is this possible?
Answer the question
In order to leave comments, you need to log in
You can't achieve this with javascript. Although, if the script is only for Firefox, then try
function copyToClipboard(text){
unsafeWindow.netscape.security.PrivilegeManager.enablePrivilege("UniversalXPConnect");
var clipboardHelper = Components.classes["@mozilla.org/widget/clipboardhelper;1"].
getService(Components.interfaces.nsIClipboardHelper);
clipboardHelper.copyString(text);
}
}
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question