Non-modal popups at start of Firefox
[email protected] Mon, 14 Jul 2014 00:14:45 -0700 (PDT)
| Newsgroups | gmane.comp.mozilla.devel.xpfe |
|---|---|
| Message-ID | <[email protected]> |
Hi. I've got a Firefox (non-bootstrapped) add-on in plain Javascript (or some kind of non-intrusive notification). I'd like it show a non-modal popup when Firefox starts. What's a good place or trigger to show them, please? The add-on has no window/GUI of its own (it provides a JS module).
I've tried to show a popup in my overlay of Firefox's browser.xul, using following three options from https://developer.mozilla.org/en-US/Add-ons/Code_snippets/Alerts_and_Notifications:
1.
Components.classes['@mozilla.org/alerts-service;1'].
getService(Components.interfaces.nsIAlertsService).
showAlertNotification(null, 'Some title', 'Some message', false, , null);
2.
var win = Components.classes['@mozilla.org/embedcomp/window-watcher;1'].
getService(Components.interfaces.nsIWindowWatcher).
openWindow(null, 'chrome://global/content/alerts/alert.xul',
'_blank', 'chrome,titlebar=no,popup=yes', null);
win.arguments = [null, 'Some title', 'Some message', false, ];
3. var message = 'Another pop-up blocked'; var nb = gBrowser.getNotificationBox(); var n = nb.getNotificationWithValue('popup-blocked'); if(n) {
n.label = message;
} else {
var buttons = [{
label: 'Button',
accessKey: 'B',
popup: 'blockedPopupOptions',
callback: null
}];
Neither of them works on Windows 7 x64 (SP 1). The first two work on Linux (Fedora 20 x64). Neither of the non-working ones generates any error/warning.
Please, suggest how/where to do that, or how to 'schedule it' (as an event handler to a system event, I suppose) from my overlay of browser.xul.