Hi Aaron,

thanks for your support.

Unfortunately I cannot find a way to distinguish (handling
onbeforeunload or unload events) if the user has clicked on X to
close
the tab, or the page in unloading to other reasons (page change, new
urls...). Do you know how this events can be distinguished? I need to
avoid the tab close only when the user is trying to close it with the
X.

If I can solve this issue I think that the "SaveTheLastTab" extension
can be realized, otherwise I think it's impossible with current APIs.

As you suggested I wrote a Feature Request regarding the possibility
to prevent default action in Chrome event handlers:
http://code.google.com/p/chromium/issues/detail?id=30198

I think that this feature will be very usefull for all event
handlers.
For example the can be also the need to prevent a page change when a
specific-url is clicked and so on...

Kind reagards,
Luca

> On 12 Dic, 02:58, Aaron Boodman <a...@google.com> wrote:
>
>
>
> > 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 usinghttp://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