Overview
Theglide.tabs API provides methods for querying, managing, and controlling browser tabs. This includes getting the active tab, finding tabs by properties, and unloading tabs to reduce memory usage.
Methods
active()
Returns the active tab for the currently focused window.A promise that resolves to the active tab object with a guaranteed
id property.get_first()
Find the first tab matching the given query filter.Query object to filter tabs. Supports properties like:
title: Match tab titleurl: Match tab URL (supports wildcards)active: Whether the tab is activecurrentWindow: Whether the tab is in the current window- And other standard WebExtension tab query properties
A promise that resolves to the first matching tab, or
undefined if no tabs match.query()
Gets all tabs that have the specified properties, or all tabs if no properties are specified.Query object to filter tabs. Same properties as
get_first().A promise that resolves to an array of all matching tabs. Returns an empty array if no tabs match.
unload()
Unload the given tabs to reduce memory usage.Variable number of tabs to unload. Can be tab IDs (numbers) or tab objects.
A promise that resolves when all tabs have been unloaded.
Unloading tabs is similar to Firefox’s “Unload Tab” feature. The tab remains visible in the tab bar but its content is freed from memory. When you click on an unloaded tab, it automatically reloads.Learn more about unloading tabs
Complete Example
glide.ts
Type Reference
glide.TabWithID
A tab object that is guaranteed to have anid property:
Browser.Tabs.Tab but ensures the id is always present (not undefined).