Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

148
Views
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 answers
Answer question

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 Report
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!