Seeking guidance: As I develop an addon, my objective is to initiate a HTTP request upon clicking the ActionButton. The data to be sent to the server includes the URL of the tab and the content of the page.
Initially, I attempted to create a log message and retrieve it from the console(listener), only to realize that this approach was ineffective. Subsequently, I experimented with injecting (pageMod) contentScript into the website when the button is clicked. However, this method proved to be flawed as well, leading to the code being executed multiple times instead of just once.
Snippet from main.js:
var button = buttons.ActionButton({
id: "bookmark-link",
label: "Bookmark this website",
icon: {
"16": "./status-bar.png",
"32": "./toolbar-large.png",
"64": "./toolbar-large.png"
},
onClick: function() {
log("triggered!"); // Need to perform Ajax GET request here
}
});
This issue has consumed my thoughts throughout the night, leaving me unable to find a satisfactory solution on my own. Thus, I am reaching out for assistance here. Your time and input are greatly appreciated!
Many thanks.