I'm fresh to firefox addons development, so pls excuse me if it's too dumb. I just couldnt find the answer here in the Stack.
I try to launch an alert window from my addon:
alert('This is an alert');
However, it won't recognize 'alert'. What component should I include (Require)?
Thanks!
Go to the browser menu and select "Settings." On the left, click on "Privacy & Security." Scroll down to the "Permissions" window, and select "Notification." If you want to disable notifications, check "Pause notifications until Firefox restarts." Thus, notifications will not appear until you restart Firefox.
For a modal alert, as the question asks, better to use prompt-service, not alerts-service:
var prompts = Cc["@mozilla.org/embedcomp/prompt-service;1"].getService(Ci.nsIPromptService);
prompts.alert(null, "AlertTitle", "AlertMessage");
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With