Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

alert window in my firefox addon

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!

like image 826
Hans Webb Avatar asked Aug 14 '13 15:08

Hans Webb


People also ask

How do I turn on alert box in Firefox?

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.


1 Answers

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");
like image 67
rednoyz Avatar answered Sep 27 '22 22:09

rednoyz