is-incognito-mode - v2.3.0
    Preparing search index...

    Function detectIncognito

    • Detect whether the current browser is in private / incognito mode.

      Returns a rich DetectionResult. Most callers want the thinner isIncognito convenience instead.

      Parameters

      Returns Promise<DetectionResult>

      • NOT_A_BROWSER when invoked outside a browser-like environment.
        • UNSUPPORTED_BROWSER when the browser was classified as unknown and no fallback strategy applied.
        • PROBE_FAILED when every applicable strategy threw before producing a definitive answer.
        • TIMEOUT when timeoutMs elapsed before a verdict was reached.
        • ABORTED when the supplied signal was aborted.
      import { detectIncognito } from 'is-incognito-mode';

      const { isPrivate, browser, confidence, quota } = await detectIncognito();
      console.log(`${browser} (${confidence} confidence, quota: ${quota ?? '?'})`);
      await detectIncognito({ timeoutMs: 5000 });
      
      const controller = new AbortController();
      await detectIncognito({ signal: controller.signal });