The code suggested on XULPlanet was producing a "permission denied"
error. This is because it first needs to be granted security
permissions in order to successfully access the clipboard...
The following code works in TW (using InlineJavascriptPlugin under
FireFox):
---------------
<script label="click to enter text">
if(!window.Components) return;
try
{ netscape.security.PrivilegeManager.enablePrivilege("UniversalXPConnect"); }
catch(e) { alert(e.description?e.description:e.toString()); return; }
const clip=Components.classes["@
mozilla.org/widget/clipboardhelper;
1"].getService(Components.interfaces.nsIClipboardHelper);
clip.copyString(prompt("please enter text to put on clipboard"));
</script>
Paste text here to confirm clipboard contents:
<html><textarea rows=5 cols=50></textarea></html>
---------------
enjoy,