欢迎 What's new in Chrome extensions Get help with Chrome extensions API reference Samples
欢迎 What's new in Chrome extensions Get help with Chrome extensions API reference Samples

Manifest - Incognito

Published on Updated on

Warning

The Chrome Web Store no longer accepts Manifest V2 extensions. Please use Manifest V3 when building new extensions. You will find a section on upgrading in the navigation tree at the left, including the Manifest V2 support timeline.

Use the "incognito" manifest key with either "spanning" or "split" to specify how this extension will behave if allowed to run in incognito mode. Using "not_allowed" to prevent this extension from being enabled in incognito mode.

Only extensions can choose. Apps will always use the default value for the app type; "spanning" for Chrome apps and "split" for installable web and legacy packaged apps.

Spanning mode

The default for extensions and Chrome apps is "spanning", which means that it will run in a single shared process. Any events or messages from an incognito tab will be sent to the shared process, with an incognito flag indicating where it came from. Because incognito tabs cannot use this shared process, an extension using the "spanning" incognito mode will not be able to load pages from its extension package into the main frame of an incognito tab.

Split mode

The default for installable web apps and legacy packaged apps is "split", which means that all app pages in an incognito window will run in their own incognito process. If the app or extension contains a background page, that will also run in the incognito process. This incognito process runs along side the regular process, but has a separate memory-only cookie store. Each process sees events and messages only from its own context (for example, the incognito process will see only incognito tab updates). The processes are unable to communicate with each other.

Not allowed

The extension cannot be enabled in incognito mode. Available from Chrome 47.

How to choose

As a rule of thumb, if your extension or app needs to load a tab in an incognito browser, use split incognito behavior. If your extension or app needs to be logged into a remote server use spanning incognito behavior.

chrome.storage.sync and chrome.storage.local are always shared between regular and incognito processes. It is recommended to use them for persisting your extension's settings.

Updated on Improve article

We serve cookies on this site to analyze traffic, remember your preferences, and optimize your experience.