[Chrome Extension] Not Being Logged in in Incognito Mode


When I was writing Chrome extension, sometimes I need to open the tab in incognito mode. But something puzzled me that when I open the tab in incognito mode, the Chrome extension still keeps the login status. This is obviously not something that I expected because when you are logged into a website and open a new tab of the same site in incognito mode, you are not logged in in the incognito mode, but the extension still keeps logged in!

After some googling, I found the incognito key in manifest json of Chrome extension. If you do not specify in the manifest.json, the default is spanning, which means you make HTTP request in the extension, you have still have the same cookie information of being logged in.

The description of incognito key on developer website does not say very clearly about this. Only the following sentences in the final:

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.

So if you want your extension to make HTTP request without being logged in in incognito mode, use "incognito" manifest key "split" in your manifest.json.


References:

[1]GitHub - siongui/igidcrx: Get Instagram Id via Chrome Extension