Etsi tuesta

Avoid support scams. We will never ask you to call or text a phone number or share personal information. Please report suspicious activity using the “Report Abuse” option.

Lue lisää

Showing non-modal popup in overlay of browser.xul - on Windows

more options

Hi. I've got a custom Firefox add-on in plain Javascript. It to overlays Firefox's browser.xul (via chrome.manifest) by an XUL file, where I would like to show a non-modal popup (or some kind of non-intrusive notification).

I've tried 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. The first two work on Linux (Fedora 20 x64). Neither of them generates any error either.

Please, suggest how/where to do that, or how to 'schedule it' (as an even handler to a system event, I suppose) from my overlay of browser.xul.

Hi. I've got a custom Firefox add-on in plain Javascript. It to overlays Firefox's browser.xul (via chrome.manifest) by an XUL file, where I would like to show a non-modal popup (or some kind of non-intrusive notification). I've tried 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. The first two work on Linux (Fedora 20 x64). Neither of them generates any error either. Please, suggest how/where to do that, or how to 'schedule it' (as an even handler to a system event, I suppose) from my overlay of browser.xul.

Kaikki vastaukset (2)

more options

By Windows I mean Windows 7 Professional x64, Service Pack 1.

more options

I think you would have a better chance of getting comments from experienced add-on developers on one of these sites: