Event onBrowserClose for Google Chrome Extension?

There is no such event in the Chrome Extension API.

There is however a chrome.windows.onRemoved event that fires each time a window closes. I figured you could check in this event if you closed the last window, but unfortunately due to the asynchronous nature of Chrome this doesn’t work.

What I tried was running a simple AJAX request in the onRemoved event handler. The AJAX request never got to the server, as Chrome had already closed before running the event (or just disregarded it).

Making the final answer be: No, currently you can’t, as far as I know. You might want to star the following bug report at http://crbug.com/30885 to get noticed on updates.

Leave a Comment