I have created an addon which shoots a new tab on firefox load and a message is displayed on the DOM of the new tab. But everytime i click on the new tab button it shows the message. I want to hamper the event after the first new tab .. i mean the new tab which we click afterwards manually should not show any "hello world" message?. Is it possible.. Please help.. Tell me if you want more info.. Thanks in advance.. Below is the code which i used...
var tabs = require("sdk/tabs");
tabs.open("about:blank");
tabs.on('activate', function(tab) {
var worker = tab.attach({
contentScript: 'self.port.emit("html", document.body.innerHTML = "Hello World");' // contentScript sending message to add-on script
});
worker.port.on("html", function(message) { //recieving message from contentSCript
console.log(message)
})
});