Search Support

Avoid support scams. We will never ask you to call or text a phone number or share personal information. Please report suspicious activity using the “Report Abuse” option.

Learn More

Stop loading some pinned tabs when Firefox starts

  • Atsakymų nėra
  • 1 has this problem
  • 6 views
more options

How can I stop loading some pinned tabs when Firefox starts? I know I can set about:config to not load all pinned tabs. What I want to do is not load some specific pinned tabs instead of all pinned tabs. I made a simple addon like the one I attached and tested it, but some tabs are loaded. I have tested this code with about 10 tabs pinned. (When I actually create the addon, I would run browser.tabs.discard() with a specific tab, but this will stop loading all tabs for testing.) This is unstable. Is there any sure way to stop the load?

--- manifest.json {

   "manifest_version": 2,
   "name": "discard test",
   "version": "1.0.0.0",
   "permissions": [

"tabs"

   ],
   "background": {

"scripts": [ "background.js" ]

   }

}

--- background.js browser.runtime.onStartup.addListener(discard_pinned_tabs); function discard_pinned_tabs() {

   browser.tabs.query({pinned: true}).then(async tabs => {

for (let tab of tabs) { await browser.tabs.discard(tab.id);

	    console.log(tab.index, tab.id, tab.discarded, tab.title, tab);

}

   });

}

// browser.tabs.query({pinned: true}).then(async tabs => { // for (let tab of tabs) { // await browser.tabs.discard(tab.id); // console.log(tab.index, tab.id, tab.discarded, tab.title, tab); // } // });

setTimeout(() => {

   browser.tabs.query({pinned: true}).then(tabs => {

for (let tab of tabs) { if (!tab.discarded) { console.log(tab.index, tab.id, tab.discarded, tab.title, tab); } }

   });

}, 5000);

How can I stop loading some pinned tabs when Firefox starts? I know I can set about:config to not load all pinned tabs. What I want to do is not load some specific pinned tabs instead of all pinned tabs. I made a simple addon like the one I attached and tested it, but some tabs are loaded. I have tested this code with about 10 tabs pinned. (When I actually create the addon, I would run browser.tabs.discard() with a specific tab, but this will stop loading all tabs for testing.) This is unstable. Is there any sure way to stop the load? --- manifest.json { "manifest_version": 2, "name": "discard test", "version": "1.0.0.0", "permissions": [ "tabs" ], "background": { "scripts": [ "background.js" ] } } --- background.js browser.runtime.onStartup.addListener(discard_pinned_tabs); function discard_pinned_tabs() { browser.tabs.query({pinned: true}).then(async tabs => { for (let tab of tabs) { await browser.tabs.discard(tab.id); console.log(tab.index, tab.id, tab.discarded, tab.title, tab); } }); } // browser.tabs.query({pinned: true}).then(async tabs => { // for (let tab of tabs) { // await browser.tabs.discard(tab.id); // console.log(tab.index, tab.id, tab.discarded, tab.title, tab); // } // }); setTimeout(() => { browser.tabs.query({pinned: true}).then(tabs => { for (let tab of tabs) { if (!tab.discarded) { console.log(tab.index, tab.id, tab.discarded, tab.title, tab); } } }); }, 5000);