-
Notifications
You must be signed in to change notification settings - Fork 22.4k
/
index.md
68 lines (54 loc) · 2.56 KB
/
index.md
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
---
title: incognito
slug: Mozilla/Add-ons/WebExtensions/manifest.json/incognito
page-type: webextension-manifest-key
browser-compat: webextensions.manifest.incognito
---
{{AddonSidebar}}
<table class="fullwidth-table standard-table">
<tbody>
<tr>
<th scope="row">Type</th>
<td><code>String</code></td>
</tr>
<tr>
<th scope="row">Mandatory</th>
<td>No</td>
</tr>
<tr>
<th scope="row">Manifest version</th>
<td>2 or higher</td>
</tr>
<tr>
<th scope="row">Example</th>
<td>
<pre class="brush: json">"incognito": "spanning"</pre>
<pre class="brush: json">"incognito": "split"</pre>
<pre class="brush: json">"incognito": "not_allowed"</pre>
</td>
</tr>
</tbody>
</table>
Use the `incognito` key to control how the extension works with private browsing windows.
> **Note:** By default, extensions do not run in private browsing windows. Whether an extension can access private browsing windows is under user control. For details, see [Extensions in Private Browsing](https://support.mozilla.org/en-US/kb/extensions-private-browsing). Your extension can check whether it can access private browsing windows using {{WebExtAPIRef("extension.isAllowedIncognitoAccess")}}.
This is a string that can take any of these values:
- "spanning" (the default): the extension will see events from private and non-private windows and tabs. Windows and tabs will get an `incognito` property in the [`Window`](/en-US/docs/Mozilla/Add-ons/WebExtensions/API/windows/Window) or [`Tab`](/en-US/docs/Mozilla/Add-ons/WebExtensions/API/tabs/Tab) that represents them. This property indicates whether or not the object is private:
```js
browser.windows.getLastFocused().then((windowInfo) => {
console.log(`Window is private: ${windowInfo.incognito}`);
});
```
- "split": the extension will be split between private and non-private windows. There are effectively two copies of the extension running: one sees only non-private windows, the other sees only private windows. Each copy has isolated access to Web APIs (so, for example, [`localStorage`](/en-US/docs/Web/API/Window/localStorage) is not shared). However, the WebExtension API [`storage.local`](/en-US/docs/Mozilla/Add-ons/WebExtensions/API/storage/local) is shared. (**Note:** this setting is not supported by Firefox.)
- "not_allowed": private tabs and windows are invisible to the extension.
## Example
```json
"incognito": "spanning"
```
```json
"incognito": "split"
```
```json
"incognito": "not_allowed"
```
## Browser compatibility
{{Compat}}