Browser Extension Tab Zoom: Settings, Scope, Modes, and Capture
How extension tab zoom, webview zoom modes, and captured-tab zoom APIs work, including per-origin vs per-tab scope and limits.
This page summarizes Google Chrome documentation on controlling page zoom in browser tabs: the extension tabs API (Manifest V3 browser.tabs and Manifest V2 chrome.tabs), embedded webview guests, and CaptureController for tab-capture sessions. If you are building an extension that sets zoom, reacting to user zoom, or letting users zoom a shared tab from a web app, these are the APIs and rules that apply.
Extension tabs API: what is tab zoom?
Section titled “Extension tabs API: what is tab zoom?”In a Chrome extension, tab zoom is a numeric zoom factor (not a CSS transform). You read it with tabs.getZoom() and change it with tabs.setZoom(). Who applies zoom and whether it persists across tabs or navigation is controlled separately through ZoomSettings via tabs.getZoomSettings() and tabs.setZoomSettings().
Gets the current zoom factor of a specified tab.
— Google,
browser.tabs.getZoom
On Manifest V3, these methods return promises (Chrome 88+). The Manifest V2 chrome.tabs reference describes the same zoom behavior; promises are supported for MV3 and later, while other platforms may need callbacks.
How do I set the zoom factor for a tab?
Section titled “How do I set the zoom factor for a tab?”Call tabs.setZoom() with an optional tabId (default: active tab in the current window) and a zoomFactor:
The new zoom factor. A value of 0 sets the tab to its current default zoom factor. Values greater than 0 specify a (possibly non-default) zoom factor for the tab.
— Google,
browser.tabs.setZoom
Use 0 when you want to snap back to the tab’s default zoom without hard-coding a factor.
When does zoom settings reset on navigation?
Section titled “When does zoom settings reset on navigation?”ZoomSettings from tabs.setZoomSettings() reset to defaults when the tab navigates. Plan extension logic accordingly: re-apply settings after tabs.onUpdated navigation if you need non-default behavior on every page.
ZoomSettings: mode and scope explained
Section titled “ZoomSettings: mode and scope explained”ZoomSettings defines how zoom changes in a tab are handled and at what scope:
Defines how zoom changes in a tab are handled and at what scope.
— Google,
ZoomSettings
| Property | Role |
|---|---|
mode (ZoomSettingsMode) |
Who scales the page: browser (automatic), extension (manual), or nobody (disabled) |
scope (ZoomSettingsScope) |
Whether zoom applies per origin or only in this tab |
defaultZoomFactor |
Returned default zoom level for the tab (e.g. when reading settings) |
Defaults from the reference: mode defaults to automatic; scope defaults to per-origin in automatic mode and per-tab otherwise.
What do automatic, manual, and disabled zoom modes do?
Section titled “What do automatic, manual, and disabled zoom modes do?”| Mode | Behavior |
|---|---|
automatic |
Zoom is handled automatically by the browser. |
manual |
Overrides automatic handling; onZoomChange still fires and the extension must listen and scale the page itself. Does not support per-origin zooming—ignores scope and assumes per-tab. |
disabled |
Disables all zooming in the tab; reverts to default zoom; further zoom attempts are ignored. |
“manual” — Overrides the automatic handling of zoom changes. The onZoomChange event will still be dispatched, and it is the extension’s responsibility to listen for this event and manually scale the page.
— Google,
ZoomSettingsMode
manual is for custom zoom UI or logic in the extension, not for simply calling setZoom() once—ordinary setZoom() still works in automatic mode.
Per-origin vs per-tab scope: which tabs stay zoomed?
Section titled “Per-origin vs per-tab scope: which tabs stay zoomed?”| Scope | Effect |
|---|---|
per-origin |
Zoom persists for the page’s origin: other tabs on the same origin zoom too; navigating within that origin keeps the same factor. Only available when mode is automatic. |
per-tab |
Zoom applies only in this tab; other tabs are unaffected. Per-tab zoom resets on navigation—after navigation, pages load with their per-origin zoom factors. |
“per-tab” — Also, per-tab zoom changes are reset on navigation; navigating a tab always loads pages with their per-origin zoom factors.
— Google,
ZoomSettingsScope
How do I react when zoom changes?
Section titled “How do I react when zoom changes?”Listen for zoom change events (documented on the tabs API with ZoomChangeInfo: newZoomFactor, oldZoomFactor, tabId, zoomSettings). In manual mode you are expected to respond to those events to apply scaling yourself.
Embedded webview: ZoomMode vs extension tabs
Section titled “Embedded webview: ZoomMode vs extension tabs”Chrome Apps–style embedders use chrome.webviewTag, not tabs.*, for guest content. Zoom is parallel in concept but uses ZoomMode instead of ZoomSettings:
Defines the how zooming is handled in the webview.
— Google,
webviewTag.ZoomMode
ZoomMode |
Extension analogue | Summary |
|---|---|---|
per-origin |
per-origin + automatic |
Zoom persists per origin within the webview partition; other webviews in the same partition on that origin follow the same factor. |
per-view |
per-tab |
Zoom only in this webview; reset on navigation; loads use per-origin factors within the partition. |
disabled |
disabled |
No zoom; default level; attempts ignored. |
Use webviewTag.getZoom() / setZoom() to change factor; scope and persistence follow the current mode from getZoomMode() / setZoomMode():
Changes the zoom factor of the page. The scope and persistence of this change are determined by the webview’s current zoom mode (see webviewTag.ZoomMode).
— Google,
webviewTag.setZoom
The zoomchange event fires when the guest page’s zoom changes—useful for UI sync, similar in spirit to extension onZoomChange.
Captured tab zoom: CaptureController for tab capture
Section titled “Captured tab zoom: CaptureController for tab capture”When a web app captures another tab (e.g. screen sharing), zoom on the captured tab is exposed through CaptureController, not the extension tabs API.
Reading zoom during capture
Section titled “Reading zoom during capture”zoomLevel(read-only): current zoom of the captured tab as a percentage relative to default (100% = default). It isnullfor surface types without a defined zoom (today: defined for tabs, not windows or screens).getSupportedZoomLevels(): monotonically increasing list of supported percentages, always including 100. Callable only with an active tab capture; does not require thecaptured-surface-controlpermission.
This method returns a list of zoom levels supported by the browser for the surface type being captured. Values in this list are represented as a percentage relative to the “default zoom level”, which is defined as 100%.
— Google,
getSupportedZoomLevels()
Important: getSupportedZoomLevels() results can vary across browsers and browser versions. Avoid hard-coding these values to ensure your web app works reliably.
— Google, Captured surface control
Listen with zoomlevelchange when the user zooms the captured tab in the browser or when your app calls the zoom methods.
Changing zoom from the capturing app
Section titled “Changing zoom from the capturing app”increaseZoomLevel(), decreaseZoomLevel(), and resetZoomLevel() (100%) require the captured-surface-control permission. The first call to any of these—or to forwardWheel()—on a given CaptureController can show a permission prompt; a user gesture is required to show that prompt.
Calls reject if permission is missing, capture has not started or has ended, the surface is not a tab, or zoom would go past min/max. Guard increases/decreases using getSupportedZoomLevels().at(0) and .at(-1) as in the official examples.
DevTools device mode: viewport zoom (testing only)
Section titled “DevTools device mode: viewport zoom (testing only)”For manual testing, Device Mode lets you zoom the emulated viewport via the Zoom list. That control does not replace extension or CaptureController APIs; it only affects how the page is displayed in DevTools during emulation.
Common mistakes
Section titled “Common mistakes”- Expecting
setZoomSettingsto survive navigation — settings reset on navigation; re-apply if needed. - Setting
scope: "per-origin"withmode: "manual"— per-origin is ignored; only per-tab behavior applies. - Assuming one zoom factor applies everywhere — per-tab zoom does not carry across navigations the way per-origin does; webviews use partition-scoped origins.
- Hard-coding capture zoom steps — use
getSupportedZoomLevels()instead of fixed percentages. - Calling capture zoom APIs without tab capture or permission — methods fail outside an active tab capture or without
captured-surface-controlwhere required.
How to check this on your site
Section titled “How to check this on your site”-
In an extension test build, call
tabs.getZoomandtabs.getZoomSettingson a known tab, thentabs.setZoomand confirm the factor changes; navigate and confirm settings reset as documented. -
Toggle
modeandscope(automatic+per-originvsper-tab) and open a second tab on the same origin to verify shared vs isolated zoom. -
If you use a
webviewguest, setZoomModeand confirmzoomchangeand navigation behavior matchper-viewvsper-origindocs. -
For tab capture, log
controller.zoomLevelandcontroller.getSupportedZoomLevels()during an active capture; exercise zoom buttons tied to a user gesture and confirm permission and min/max guarding per captured surface control. -
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 statement you are asking about, and we will fix or clarify it.