Is it possible to make an addon that adds text to a textarea on a website?
If so what do i need to do to do this? Or what do i need to learn to do this?
As you can probably tell i’m new to firefox plugins.
Is it possible to make an addon that adds text to a textarea on a website?
If so what do i need to do to do this? Or what do i need to learn to do this?
As you can probably tell i’m new to firefox plugins.
Yes, you can do that with a content script. I suggest you start looking into WebExtensions, which is the new add-ons API. It already supports content scripts, and it’s the easiest way to make add-ons now.
So something like this shouldnt work?
var url;
var pageMod = require("sdk/page-mod");
var buttons = require('sdk/ui/button/action');
var tabs = require("sdk/tabs");
function handleClick(state) {
tabs.activeTab = url;
tabs.open({
url: "https://www.minds.com/newsfeed",
onReady: runScript
});
function runScript(tab) {
var myTextArea = document.getElementById('message');
myTextArea.innerHTML += url;
}
}
–edit: I think its not actually running the script on the page. I looked at https://developer.mozilla.org/en-US/Add-ons/SDK/Guides/Content_Scripts
to see how to do that. I tried using var contentScriptValue = ‘var myTextArea…’; and it didnt work. it does at least open a new page though.
myTextArea.innerHTML
is incorrect.
You set it by myTextArea.value
Still doesnt work unfortunately.
Could be because you’re defining the function after using it. You should test your add-on with the Browser Console open and check for errors.