The limitations of the content script approach would mean the user would not receive an alert if the last tab was: *a chrome-extension:// page *a chrome:// page (like new tab) *a page in the extension gallery *an image *an xml file etc.
(I think). On Fri, Dec 11, 2009 at 12:53 PM, Aaron Boodman <a...@google.com> wrote: > On Fri, Dec 11, 2009 at 5:21 AM, Luca C. <luca1...@gmail.com> wrote: > > Hi, > > > > I'am trying to write an extension to avoid Chrome to shut down when > > the last tab is closed. > > Ah interesting idea. > > > My idea was, adding an event listener when a tab is closed, to check > > if it's the last tab and in that case to open a new one. > > > > The extension is working but only when the tab is not the last: if I > > set that when there are two remaining tabs are open a new one shall be > > created it's working fine, but when I trigger the creation of the new > > tab when the last one is closed, Chrome continues shutting down > > completely. > > > > My expectation was that Chrome evaluate if complete shutting down is > > needed only after the tab event handler, instead I suppose that this > > evaluation is done before. Do you think this is a bug? > > It's not a bug, it is by design. One way you could do this is with a > content script - you can put an unload handler in each page and in it, > show an alert box confirming if the user would like to shut down. > > - 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<chromium-extensions%2bunsubscr...@googlegroups.com> > . > For more options, visit this group at > http://groups.google.com/group/chromium-extensions?hl=en. > > > -- 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.