Search code examples
javascriptfirefox-addonfirefox-addon-sdk

Add data from clipboard to out-of-page inputs via firefox addon


I develop an addon for Firefox and have the next question: is there a way to paste data from clipboard to borwser elements like a search or url field using Firefox addon api? And what is the best way to solve such kind of problem?


Solution

  • Yes get the data on the clipboard with: paste data from clipboard using document.execCommand("paste"); within firefox extension

    Then do Services.wm.getMostRecentWindow('navigator:browser').gURLBar.value = varHoldingPasteData;