tabs.create()

Creates a new tab.

Syntax

browser.tabs.create(
  createProperties,   // object
  function(tab) {...} // optional function
)

Parameters

createProperties
object. Properties to give the new tab.
windowIdOptional
integer. The window to create the new tab in. Defaults to the current window.
indexOptional
integer. The position the tab should take in the window. The provided value will be clamped to between zero and the number of tabs in the window.
urlOptional
string. The URL to navigate the tab to initially. Fully-qualified URLs must include a scheme (i.e. 'http://www.google.com', not 'www.google.com'). Relative URLs will be relative to the current page within the extension. Defaults to the New Tab Page.
For security reasons, in Firefox, this may not be a privileged URL. So passing any of the following URLs will fail, with runtime.lastError being set to an error message:
  • chrome: URLs
  • javascript: URLs
  • data: URLs
  • privileged about: URLs (for example, about:config, about:addons, about:debugging) . Non-privileged URLs (about:home, about:newtab, about:blank) are allowed.
activeOptional
boolean. Whether the tab should become the active tab in the window. Does not affect whether the window is focused (see windows.update). Defaults to true.
selectedOptional
boolean. Whether the tab should become the selected tab in the window. Defaults to true.
This property is deprecated, and is not supported in Firefox. Use active instead.
pinnedOptional
boolean. Whether the tab should be pinned. Defaults to false.
openerTabIdOptional
integer. The ID of the tab that opened this tab. If specified, the opener tab must be in the same window as the newly created tab.
callbackOptional
function. The function is passed the following arguments:
tab
tabs.Tab. Details about the created tab. Will contain the ID of the new tab.

Browser compatibility

EdgeFirefoxChromeOpera
Basic support?45.01Yes33
Firefox
Basic supportNo

1. The 'selected' option is deprecated and not supported in Firefox. Use 'active' instead.

Examples

Example add-ons

Acknowledgements

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

Document Tags and Contributors

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