4

[Chrome Extension] Not Being Logged in in Incognito Mode

 1 year ago
source link: http://siongui.github.io/2018/02/28/crx-no-login-status-incognito-mode/
Go to the source link to view the article. You can view the picture content, updated content and better typesetting reading experience. If the link is broken, please click the button below to view the snapshot at that time.

[Chrome Extension] Not Being Logged in in Incognito Mode

February 28, 2018

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


About Joyk


Aggregate valuable and interesting links.
Joyk means Joy of geeK