0

In chrome extension, i check user login with ajax request and cookie. It works fine except incognito mode. The problem is it does not detect whether a particular website is login in incognito or not. So any ajax request send will directly check for login in normal mode of chrome.

How to send ajax request in incognito mode from chome extension?

Ajeet Lakhani
  • 3,768
  • 2
  • 22
  • 37

1 Answers1

0

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!

Community
  • 1
  • 1
Mr.Rebot
  • 6,703
  • 2
  • 16
  • 91