Please note, this is a STATIC archive of website developer.mozilla.org from 03 Nov 2016, cach3.com does not collect or store any user information, there is no "phishing" involved.

tabs.setZoom()

Zooms the specified tab.

Syntax

chrome.tabs.setZoom(
  tabId,           // optional integer
  zoomFactor,      // number
  function() {...} // optional function
)

This API is also available as browser.tabs.setZoom() in a version that returns a promise.

Parameters

tabIdOptional
integer. The ID of the tab to zoom. Defaults to the active tab of the current window.
zoomFactor
number. The new zoom factor. Use a value of 0 here to set the tab to its current default zoom factor. Otherwise, this must be  a number between 0.3 and 3, specifying a zoom factor.
callbackOptional
function. Called, with no arguments after the zoom factor has been changed.

Browser compatibility

Chrome Edge Firefox Firefox for Android Opera
Basic support Yes No 45.0 No 33

Examples

Set the zoom factor for the current tab to 2:

chrome.tabs.setZoom(2);

Set the zoom factor for the current tab to 0.5, and call onSet() when the zoom factor has been set:

function onSet() {
  console.log("done");
}

chrome.tabs.setZoom(0.5, onSet);

Set the zoom factor for the tab whose ID is 2 to 0.5, and call onSet() when the zoom factor has been set:

function onSet() {
  console.log("done");
}

chrome.tabs.setZoom(2, 0.5, onSet);

Acknowledgements

This API is based on Chromium's chrome.tabs API. This documentation is derived from tabs.json in the Chromium code.

Microsoft Edge compatibility data is supplied by Microsoft Corporation and is included here under the Creative Commons Attribution 3.0 United States License.

Document Tags and Contributors

 Contributors to this page: Makyen, wbamberg
 Last updated by: Makyen,