On Fri, Dec 11, 2009 at 3:23 PM, Luca C. <luca1...@gmail.com> wrote:
> As far as I know the unload event doesn't allow to event handler to
> prevent the default action, so I suppose that also in that case the
> browser will shut down.

Take a look at the onbeforeunload handler. It does what you're asking about.

> From my point of view Chrome API should allow to prevent default
> action in tab/window event handlers. In that way if the last tab is
> closed, the event handler can stop the default action and let the tab
> open.

I agree this would be ideal. Unfortunately we can't do everything, but
we will keep it in mind for a future version. If you would like, you
can file a feature request using http://new.crbug.com. That way if
other users have this same request, they can star the issue and see
discussion there.

> Thinking about your proposal I get the following doubt: if in unload
> event handler  for last tab I open a new tab, Chrome will evaluate the
> complete shut down before or after the unload event handler?
> (this solution requires that I communicate with a background script
> that is allowed to access to Chrome API to get the number of opened
> tabs)

The browser will wait for onbeforeunload to complete, and it allows
the users to cancel the default action.

- a

--

You received this message because you are subscribed to the Google Groups 
"Chromium-extensions" group.
To post to this group, send email to chromium-extensi...@googlegroups.com.
To unsubscribe from this group, send email to 
chromium-extensions+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/chromium-extensions?hl=en.


Reply via email to