Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to get notification when window closes in Firefox extension?

I am making toolbar for Mozilla Firefox. On the click of a button on my toolbar, I am opening a new window which navigates to my HTML Page created by me. On this HTML Page on the click of a button I am doing some work and closing the window.

That's all done, now I need my original or parent window's toolbar to get notified when this window is closed. I guess adding event listeners won't work as its all done in new window. Please suggest.

Any help is appreciated

like image 451
Yashwant Kumar Sahu Avatar asked Dec 30 '10 14:12

Yashwant Kumar Sahu


People also ask

How do I enable alerts when closing multiple tabs in Firefox?

Get a Warning When You Close Multiple Tabs in FirefoxOn the “Settings” window, in the left sidebar, click “General.” On the “General” screen, in the “Tabs” section, enable the “Confirm Before Closing Multiple Tabs” option.

How do I get Firefox notifications for windows?

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.

How do I add notification sounds to Firefox?

Extension Metadata The default Firefox notification system doesn't notify you with audio, only visually. This extensions adds sounds to some notifications. Choose if which websites and supported extensions you want a sound to be played for. You can both work on an include or exclude principle.


1 Answers

You can use "window.onbeforeunload" event.

Here is the reference page: https://developer.mozilla.org/en-US/docs/Web/API/WindowEventHandlers/onbeforeunload

like image 103
Vikram.exe Avatar answered Oct 14 '22 19:10

Vikram.exe