MozillaZine

cancel the tab close programmatically

Talk about add-ons and extension development.
Diamanti
 
Posts: 701
Joined: June 12th, 2008, 9:02 am

Post Posted November 7th, 2016, 5:30 am

I have a TabClose event.
How to cancel the tab close programmatically?
gBrowser.tabContainer.addEventListener("TabClose", function(){return false;}, false);

lithopsian
 
Posts: 3664
Joined: September 15th, 2010, 9:03 am

Post Posted November 7th, 2016, 6:52 am

TabClose isn't cancellable and has no default action. It is simply a notification.

lithopsian
 
Posts: 3664
Joined: September 15th, 2010, 9:03 am

Post Posted November 7th, 2016, 3:33 pm

Just guessing, but you still want a way to stop tabs closing? You could try overwriting gBrowser.removeTab(). This is certainly a common way to close tabs, but I don't know if it is the only way. You'll have to try it and see. I'm not an expert on tabs, pesky things.

Diamanti
 
Posts: 701
Joined: June 12th, 2008, 9:02 am

Post Posted November 8th, 2016, 1:45 am

I did so ty

Return to Extension Development


Who is online

Users browsing this forum: No registered users and 2 guests