Is there event for detecting incognito access enable/disable?

Something like this:

browser.extension.onIncognitoAccessGranted.addListener(() => {

Or, maybe, it’s impossible because of privacy reasons?

1 Like

As was noted in an earlier thread your extension actually restarts when access is toggled, so there can’t be any event.

I don’t think you can detect if you have incognito access, but you can detect when you are running inside an incognito context:

1 Like

I’ve add this to onInstalled and this helps:

  if (UPDATED && Browser.IS_FIREFOX) {
    const controlledByThisExtension = await ProxyManager.controlledByThisExtension()
    const isAllowedIncognitoAccess = await Browser.extension.isAllowedIncognitoAccess()

    if (isAllowedIncognitoAccess && !controlledByThisExtension) {
        console.warn('Incognito access granted, setting proxy...')
        await ProxyManager.setProxy()

Oh right, I totally missed