Empresas
Empregos
  • Sobre nós
  • Soluções
    • Publicação de vagas
      Publique sua vaga e receba candidatos qualificados em 48h.
    • Avaliações de candidatos
      Mais de 500 testes técnicos e psicológicos, mais anti-fraude.
    • Headhunting
      Busca executiva personalizada do início ao fim.
    • Folha de Pagamento + EOR
      Dispersão de folha e EOR em mais de 15 países da LATAM.
  • Preços
  • Empregos

0

150
Visualizações
Delete group tab with javascript

I want to delete a group tab using JavaScript.

I have the current tab id, and with that i get the current group tab id (if the current tab is not in a group tab it returns -1).

Now I wonder if there is something like this :

chrome.tabs.remove(tabId)

but for the group tab, so more like :

chrome.tabGroups.remove(groupId).

Here's my code if it helps :

chrome.tabs.query({ active: true, currentWindow: true }, async function (tabs) {
    console.log(tabs[0].id, tabs[0].groupId);
    let currentTab = tabs[0].id;
    let currentGroupId = tabs[0].groupId;

    //get all the infos about the group
    let infos = await chrome.tabGroups.get(tabs[0].groupId);
  }
);
about 4 years ago · Juan Pablo Isaza
1 Respostas
Responde à pergunta

0

Use chrome.tabs.query to find the tabs with the same groupId and then call chrome.tabs.remove with an array of these tabs' ids:

async function closeGroup() {
  const [tab] = await chrome.tabs.query({active: true, currentWindow: true});
  const groupTabs = await chrome.tabs.query({groupId: tab.groupId});
  await chrome.tabs.remove(groupTabs.map(t => t.id));
}
about 4 years ago · Juan Pablo Isaza Relatório
Responde à pergunta
Encontrar trabalhos remotos

Descubra a nova forma de encontrar um emprego!

melhores empregos
Principais categorias de trabalho
Empresas
Postar vaga Preços Comercial
Jurídico
Termos e Condições Política de privacidade
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomende algumas ofertas para mim
Preciso de ajuda