Tabs samples
Extension APIs for Tabs, Windows, and Browsing Data
Which extension APIs control tabs, windows, history, cookies, and downloads—and where permissions and context limits apply.
This page summarises Chrome Extensions documentation on APIs that let an extension customize and react to the browser: manage tabs and windows, read or change browsing data, and hook into UI surfaces such as the omnibox. The Develop hub groups these capabilities under “modify and observe the browser,” alongside samples linked from individual API pages.
Tabs API: create, query, modify, and rearrange tabs
Section titled “Tabs API: create, query, modify, and rearrange tabs”The chrome.tabs / browser.tabs API is the main way an extension interacts with the browser’s tab system.
Use the chrome.tabs API to interact with the browser’s tab system. You can use this API to create, modify, and rearrange tabs in the browser.
— Chrome, tabs
Beyond open/close/move operations, the same API can detect a tab’s language, capture a screenshot, and talk to that tab’s content scripts—so one permission family covers both “tab manager” and “drive the page” workflows.
The Tabs API not only offers features for manipulating and managing tabs, but can also detect the language of the tab, take a screenshot, and communicate with a tab’s content scripts.
— Chrome, tabs
A popup tabs manager tutorial states the same scope in tutorial terms: create, query, modify, and rearrange tabs.
Where the Tabs API may run (not in content scripts)
Section titled “Where the Tabs API may run (not in content scripts)”Service workers and extension pages may call the Tabs API; content scripts cannot.
Note: The Tabs API can be used by the service worker and extension pages, but not content scripts.
— Chrome, tabs
If logic lives in a content script, route tab control through runtime.sendMessage (or similar) to the service worker, which then calls tabs.*.
tabGroups vs tabs: which API for grouping?
Section titled “tabGroups vs tabs: which API for grouping?”Tab groups (labels, colors, collapsed state) use chrome.tabGroups / browser.tabGroups. Actual grouping/ungrouping of tabs and queries about which tabs sit in a group are done with chrome.tabs.
Use the chrome.tabGroups API to interact with the browser’s tab grouping system. You can use this API to modify and rearrange tab groups in the browser. To group and ungroup tabs, or to query what tabs are in groups, use the chrome.tabs API.
— Chrome, tabGroups
The tabGroups reference lists the manifest permission name tabGroups.
Windows API: browser windows and nested tab objects
Section titled “Windows API: browser windows and nested tab objects”The chrome.windows / browser.windows API creates, updates, and arranges windows. A windows.Window can include an array of tabs.Tab objects when the extension requests that detail.
Use the chrome.windows API to interact with browser windows. You can use this API to create, modify, and rearrange windows in the browser.
— Chrome, windows
windows API and the tabs permission
Section titled “windows API and the tabs permission”If you need url, pendingUrl, title, or favIconUrl on those nested tab objects, declare the "tabs" permission in the manifest—not only when using tabs.* directly.
When requested, a windows.Window contains an array of tabs.Tab objects. You must declare the “tabs” permission in your manifest if you need access to the url, pendingUrl, title, or favIconUrl properties of tabs.Tab.
— Chrome, windows
Example shape from the same page:
{ "name": "My extension", "permissions": ["tabs"]}Develop recommends browser.tabs, browser.tabGroups, and browser.windows together when the goal is to “create, modify, and arrange the user’s browser.”
Sessions API: restore tabs and windows after a crash
Section titled “Sessions API: restore tabs and windows after a crash”When users ask to “bring back what I had open,” chrome.sessions / browser.sessions targets saved browsing session state (tabs and windows), not the full history list.
Use the chrome.sessions API to query and restore tabs and windows from a browsing session.
— Chrome, sessions
Pair with the Tabs/Windows APIs if you need to change restored items after reading session data.
History, top sites, and reading list
Section titled “History, top sites, and reading list”history API: visited URLs in the record
Section titled “history API: visited URLs in the record”Use the chrome.history API to interact with the browser’s record of visited pages. You can add, remove, and query for URLs in the browser’s history. To override the history page with your own version, see Override Pages.
— Chrome, history
The Develop “Manage history” section also points to browser.browsingData for clearing other browsing data (not duplicated in every API stub in this cluster). For “most visited” tiles on the new tab page (not user-edited shortcuts), use browser.topSites.
Use the chrome.topSites API to access the top sites (i.e. most visited sites) that are displayed on the new tab page. These do not include shortcuts customized by the user.
— Chrome, topSites
Extensions and AI frames a product direction: enrich bookmarks, improve the new tab experience, or help users re-discover content from browsing history—typical consumers of history/topSites APIs.
readingList API
Section titled “readingList API”Use the chrome.readingList API to read from and modify the items in the Reading List.
— Chrome, readingList
See the Reading List API sample linked from that reference for demos.
Cookies, DNS, and public suffix
Section titled “Cookies, DNS, and public suffix”| API | Role |
|---|---|
cookies |
Query, modify cookies; subscribe to cookie changes |
dns |
DNS resolution from the extension |
publicSuffix |
Query the browser’s Public Suffix List (PSL) |
Use the chrome.cookies API to query and modify cookies, and to be notified when they change.
— Chrome, cookies
Use the chrome.dns API for dns resolution.
— Chrome, dns
Use the chrome.publicSuffix API to query the browser’s Public Suffix List (PSL).
— Chrome, publicSuffix
Cookie work often sits next to loginState, which “read[s] and monitor[s] the login state” (loginState).
Downloads API: initiate, monitor, and search
Section titled “Downloads API: initiate, monitor, and search”Use the chrome.downloads API to programmatically initiate, monitor, manipulate, and search for downloads.
— Chrome, downloads
The downloads reference points to examples/api/downloads and Samples for minimal examples—useful when validating event listeners before building a full UI.
Omnibox, search, and privacy-related browser settings
Section titled “Omnibox, search, and privacy-related browser settings”omnibox: customize the address bar; try the omnibox API example from chrome-extension-samples (linked on omnibox).search: “search via the default provider” (search).privacy: control Chrome features that affect privacy; Develop also mentionsbrowser.proxyfor proxy settings. Sample: privacy API example.
Supporting APIs: processes, offscreen, DOM, metrics, logs
Section titled “Supporting APIs: processes, offscreen, DOM, metrics, logs”These appear in the same “browser platform” cluster but solve narrower jobs:
| API | Purpose |
|---|---|
processes |
Interact with browser processes |
offscreen |
Create and manage offscreen documents |
dom |
Access DOM APIs reserved for extensions |
printingMetrics |
Printing usage metrics |
systemLog |
Record Chrome system logs from extensions |
Quote for offscreen and processes:
Use the offscreen API to create and manage offscreen documents.
— Chrome, offscreen
Use the chrome.processes API to interact with the browser’s processes.
— Chrome, processes
chrome.* vs browser.* and Manifest V2 references
Section titled “chrome.* vs browser.* and Manifest V2 references”This cluster includes parallel Manifest V3 (…/extensions/reference/api/…) and Manifest V2 (…/extensions/mv2/reference/…) pages with the same one-line descriptions—for example MV3 cookies and MV2 cookies. Prefer the MV3 reference for new work; use MV2 pages only while migrating legacy code.
Cross-browser code typically uses the browser namespace (cookies is documented under browser.cookies in doc 1). Develop consistently names browser.tabs, browser.history, and related APIs in its task-oriented sections.
Why not build your own “tabs” in a web page?
Section titled “Why not build your own “tabs” in a web page?”PWA tabbed application mode explains a trade-off separate from extension APIs: real browser tabs get resource isolation and scale to many tabs; developer-built tab UIs inside one page do not, and browser affordances (history, “Copy this page URL,” cast, open in browser) attach to the shell page—not the embedded “document tab.”
Having documents in separate browser tabs comes with resource isolation, which is not possible using the web today. Developer-built tabs wouldn’t scale acceptably to hundreds of tabs like browser tabs do.
— Chrome, Tabbed application mode for PWAs
Extensions that need true multi-document isolation should drive real tabs/windows, not simulate tabs in a single page.
Samples and common mistakes
Section titled “Samples and common mistakes”Try an API quickly
Common mistakes:
- Calling
tabs.*from a content script—move tab control to the service worker (tabs). - Using
windows.get*and reading tab URLs without"tabs"in the manifest (windows). - Confusing
tabGroupswith grouping operations that live ontabs(tabGroups). - Expecting
topSitesto include user-pinned shortcuts—it does not (topSites). - Mixing session restore (
sessions) with history queries (history) when the user only cares about “currently open” vs “ever visited.”
Remote debugging is for inspecting tabs on a device (pause, focus, reload, close)—complementary to extension APIs, not a substitute for tabs programmatic control. Chrome DevTools media tooling debugs players per browser tab during development.
How to check this on your site
Section titled “How to check this on your site”- Load your unpacked extension, open the service worker console, and call a minimal
chrome.tabs.query({})(orbrowser.tabs.query) to confirm the Tabs API is available where you expect—not inside content scripts (tabs). - From an extension page, request a window with tab details and verify
tab.urlis defined only when"tabs"is in the manifest (windows). - Install the official Tabs Manager tutorial build or the MV3 sample named on tabs and compare behavior to your extension.
- For history/topSites/download flows, install the matching sample from the API page you use (history, downloads).
- You can check automatically in Answerwell (our tool): https://answerwell.org/workspace
Report an error or ask a question
Section titled “Report an error or ask a question”If something on this page is wrong or unclear, email yimasynthetic@gmail.com with the page URL and the exact sentence you are asking about, and we will correct or clarify it.