You can set your chrome extension to function in incognito mode (manually the is no option for automatically set it through code or by default)
![enter image description here]()
Image from Chromium Blog.
Then to check if it is working in incognito mode :
chrome.extension.isAllowedIncognitoAccess(function callback)
Retrieves the state of the extension's access to Incognito-mode (as determined by the user-controlled 'Allowed in Incognito' checkbox.
Code Sample by Rob
chrome.extension.isAllowedIncognitoAccess(function(isAllowedAccess) {
if (isAllowedAccess) return; // Great, we've got access
// alert for a quick demonstration, please create your own user-friendly UI
alert('Please allow incognito mode in the following screen.');
chrome.tabs.create({
url: 'chrome://extensions/?id=' + chrome.runtime.id
});
});
Hope this helps!