Docs
Web API
chrome.tabs
The tabs of Wren's windows, as the shell describes them (src/page/ext_api.odin, ext_tabs.odin). A tab's url and title are given only with the tabs permission, a host grant for its URL, or for the extension's own pages. create, update and remove act from a task of the loop of their own, then answer.
Gate: no permission; contexts: Background, Popup, Tab. Source: api/ext_tabs.widl.
# Methods and properties
Member Result Status Gate
query(optional QueryInfo queryInfo)Tab []host
get(i64 tabId)Tab host
getCurrent()Tab host The tab of the calling page; undefined for a popup or the background.
create(CreateProperties createProperties)Tab host
update(optional i64 tabId, UpdateProperties updateProperties)Tab host No tabId: the selected tab of the current window.
remove(TabIds tabIds)void host
sendMessage(i64 tabId, any message, optional MessageSendOptions options)any host To the content scripts of the extension in the tab (one frame with frameId) that listen to runtime.onMessage. The first answer wins; with none, "Could not establish connection. Receiving end does not exist.".
connect(i64 tabId, optional TabConnectInfo connectInfo)Port realm A port to the content scripts of the extension in the tab (one frame with frameId) that listen to runtime.onConnect.
# Events
Event Listener's parameters Gate
onActivatedActiveInfo activeInfo
onUpdatedi64 tabId, ChangeInfo changeInfo, Tab tab"loading" at the request, "complete" at the document's load event.
onRemovedi64 tabId, RemoveInfo removeInfo
onCreatedTab tab
onReplacedi64 addedTabId, i64 removedTabId
onAttachedi64 tabId, object attachInfo
onDetachedi64 tabId, object detachInfo
onMovedi64 tabId, object moveInfo
onHighlightedobject highlightInfo
# Constants
TAB_ID_NONE = -1
TAB_INDEX_NONE = -1
# Types
# TabStatus
A string: "unloaded", "loading", "complete". chrome.tabs.TabStatus names them.
# UrlOrUrls
One URL or match pattern, or a list of them.
One of: string or string[].
# TabIds
One tab id, or a list of them.
One of: i64 or i64[].
# MutedInfo
# Tab
Property Type
idi64
indexi64
windowIdi64
activebool
highlightedbool
selectedbool
pinnedbool
incognitobool
discardedbool
autoDiscardablebool
frozenbool
groupIdi64
audiblebool
mutedInfoMutedInfo
statusTabStatus
url (optional)string
title (optional)string
# QueryInfo
Property Type
active (optional)bool
currentWindow (optional)bool
lastFocusedWindow (optional)bool
windowId (optional)i64 -2: the current window.
highlighted (optional)bool
pinned (optional)bool
status (optional)TabStatus
index (optional)i64
url (optional)UrlOrUrls Match patterns; tabs whose URL the extension may not see never match.
# CreateProperties
Property Type
windowId (optional)i64
index (optional)i64
url (optional)string A web page, about:blank or a file of the extension (relative to its root).
active (optional)bool
selected (optional)bool
pinned (optional)bool
openerTabId (optional)i64
# UpdateProperties
Property Type
url (optional)string
active (optional)bool
highlighted (optional)bool
selected (optional)bool
pinned (optional)bool
muted (optional)bool
# ActiveInfo
Property Type
tabIdi64
windowIdi64
# ChangeInfo
Property Type
status (optional)TabStatus
url (optional)string
# RemoveInfo
Property Type
windowIdi64
isWindowClosingbool
# MessageSendOptions
Property Type
frameId (optional)i64 One frame only (0: the top document).
documentId (optional)string
# TabConnectInfo
Property Type
name (optional)string
frameId (optional)i64
documentId (optional)string
Previous chrome.storage.sync
Next chrome.webNavigation
Edit this page on GitHub
On this page