> [!WARNING]
> **Warning:** You're viewing the deprecated Manifest V2 version of this article. See [Manifest V3 - The activeTab permission](https://developer.chrome.com/docs/extensions/develop/concepts/activeTab) for the MV3 equivalent. The Chrome Web Store no longer accepts Manifest V2 extensions. Follow the [Manifest V3 Migration guide](https://developer.chrome.com/docs/extensions/develop/migrate) to convert your extension to Manifest V3.

The `activeTab` permission gives an extension temporary access to the currently active tab when the
user *invokes* the extension - for example by clicking its [browser action](https://developer.chrome.com/docs/extensions/reference/browserAction). Access to the tab
lasts while the user is on that page, and is revoked when the user navigates away or closes the tab.

This serves as an alternative for many uses of `<all_urls>`, but displays *no warning message*
during installation:

**Note:** From M72 onwards, the `activeTab` permission will be granted until the user navigates to a
different origin. That is, if the user invokes the extension on https://example.com and then
navigates to https://example.com/foo, the extension will continue to have access to the page. If the
user navigates to https://chromium.org, access is revoked.

Without `activeTab`:

![Without activeTab](https://developer.chrome.com/static/docs/extensions/mv2/manifest/activeTab/image/without-activetab-edf715c4e73b8.png)

With `activeTab`:

![With activeTab](https://developer.chrome.com/static/docs/extensions/mv2/manifest/activeTab/image/with-activetab-b8718f6cb6571.png)

## Example

See the [Page Redder](https://developer.chrome.com/docs/extensions/mv2/samples#page-redder) sample extension:

    {
      "name": "Page Redder",
      "version": "2.0",
      "permissions": [
        "activeTab"
      ],
      "background": {
        "scripts": ["background.js"],
        "persistent": false
      },
      "browser_action": {
        "default_title": "Make this page red"
      },
      "manifest_version": 2
    }

    // Called when the user clicks on the browser action.
    chrome.browserAction.onClicked.addListener(function(tab) {
      // No tabs or host permissions needed!
      console.log('Turning ' + tab.url + ' red!');
      chrome.tabs.executeScript({
        code: 'document.body.style.backgroundColor="red"'
      });
    });

## Motivation

Consider a web clipping extension that has a [browser action](https://developer.chrome.com/docs/extensions/reference/browserAction) and [context menu item](https://developer.chrome.com/docs/extensions/reference/contextMenus). This
extension may only really need to access tabs when its browser action is clicked, or when its
context menu item is executed.

Without `activeTab`, this extension would need to request full, persistent access to every web site,
just so that it could do its work if it happened to be called upon by the user. This is a lot of
power to entrust to such a simple extension. And if the extension is ever compromised, the attacker
gets access to everything the extension had.

In contrast, an extension with the `activeTab` permission only obtains access to a tab in response
to an explicit user gesture. If the extension is compromised the attacker would need to wait for the
user to invoke the extension before obtaining access. And that access only lasts until the tab is
navigated or is closed.

## What activeTab allows

While the `activeTab` permission is enabled for a tab, an extension can:

- Call [`tabs.executeScript`](https://developer.chrome.com/docs/extensions/reference/tabs#method-executeScript) or [`tabs.insertCSS`](https://developer.chrome.com/docs/extensions/reference/tabs#method-insertCSS) on that tab.
- Get the URL, title, and favicon for that tab via an API that returns a [`tabs.Tab`](https://developer.chrome.com/docs/extensions/reference/tabs#type-Tab) object (essentially, `activeTab` grants the [`tabs`](https://developer.chrome.com/docs/extensions/reference/tabs#manifest) permission temporarily).
- Intercept network requests in the tab to the tab's main frame origin using the [webRequest](https://developer.chrome.com/docs/extensions/reference/webRequest) API. The extension temporarily gets host permissions for the tab's main frame origin.

## Invoking activeTab

The following user gestures enable `activeTab`:

- Executing a [browser action](https://developer.chrome.com/docs/extensions/reference/browserAction)
- Executing a [page action](https://developer.chrome.com/docs/extensions/reference/pageAction)
- Executing a [context menu item](https://developer.chrome.com/docs/extensions/reference/contextMenus)
- Executing a keyboard shortcut from the [commands API](https://developer.chrome.com/docs/extensions/reference/commands)
- Accepting a suggestion from the [omnibox API](https://developer.chrome.com/docs/extensions/reference/omnibox)