I'm looking for a way to stop a tab using the Firefox addon SDK.
Is there any way to achieve this?
OK, here's what you want. The previous version was to see if I could get it to trigger only when the tab was closed, but I could not understand it.
Here's how: We override the removeTab function here after the guidelines:
// Keep the reference of the original function. Var _original = gBrowser.removeTab; // Override a function. GBrowser.removeTab = function () {// execute some actions before the original function call. If (window.myAddonIsInstalled = true) {var closeit = confirm ('Are you sure you want to close the tab?') // Perform the original work. If (closeit) {var rv = _original.apply (Gibroso, logic); } // Return the original result RV Return; } Other {var rv = _original.apply (Gibroso, Logic); // Original result Return RV Return; }}; When uninstalling your addon, make sure to set the window's global property
. MyAddonIs is set to false as is the recommended way to disable your functionality according to that article.
Comments
Post a Comment