Този сайт ще има ограничена функционалност, докато се извършва тече неговата поддръжка. Ако дадена статия не може реши проблема ви и искате да зададете въпрос, нашата общност е готова да ви помогне на @firefox в Twitter и /r/firefox в Reddit.

Търсене в помощните статии

Избягвайте измамите при поддръжката. Никога няма да ви помолим да се обадите или изпратите SMS на телефонен номер или да споделите лична информация. Моля, докладвайте подозрителна активност на "Докладване за злоупотреба".

Научете повече

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.

Всички отговори (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: