Back to directory
Joe12387 avatar
Joe12387 / detectIncognito

detectIncognito

JavaScript detection of Incognito & other private browsing modes on Chrome, Edge, Safari, Brave, Firefox, Opera and MSIE.

554

Stars

56

Forks

27

Watchers

MIT

License

detectIncognito.js

npm version Downloads License

Efficiently detect Incognito mode & other private browsing modes across most modern browsers.

detectIncognito

Features

  • ✅ Incognito detection on Google Chrome
  • ✅ Private Window detection on Safari (macOS)
  • ✅ Private Tab detection on Safari (iOS)
  • ✅ Private Window detection in Firefox
  • ✅ InPrivate Window detection on Microsoft Edge
  • ✅ InPrivate Window detection on Microsoft Internet Explorer
  • ✅ Private Window detection in Brave (see notes)
  • ✅ Private Window detection in Opera

Demo

Check out the live demo.

Usage

Get the script from CDN (may be blocked by adblockers—see notes):

<script src="https://cdn.jsdelivr.net/gh/Joe12387/detectIncognito@main/dist/es5/detectIncognito.min.js"></script>

Or install via NPM:

npm i detectincognitojs
import { detectIncognito } from "detectincognitojs";

detectIncognito().then((result) => {
  console.log(result.browserName, result.isPrivate);
});

Supported Browsers

Browser Platform(s) Versions Notes
Safari All ≤ 26.5
Chromium All 83 to 150
Firefox All 44 to 153
MSIE Windows 11 Requires Promise polyfill

Notes

  • False positives can occur in certain browser setups or Chrome Guest mode (Issue #21).
  • Firefox Container Tabs aren't detected by this.
  • The script must run over HTTPS—running locally or via HTTP might fail.
  • Brave and uBlock Origin block the CDN; hosting the script yourself avoids this issue.
  • An error is thrown if the browser can't be identified.

Similar Projects

  • OverpoweredJS – An advanced browser fingerprinting & bot detection solution.
  • Established Emails - Positive email reputation API for fraud teams, able to determine the minimum age of billions of emails.

License

Copyright © 2026 Joe Rutkowski
Distributed under the MIT License.

Releases

Fixes erroneous module window export and bumps tooling. Rides on v1.8.1 consumer fix regarding Firefox. What's Changed

chore: npm audit fix — bump transitive fast-uri to 3.1.5 by @Joe12387 in #68 fix...

This release reduces the false positive rate on Firefox, which was previously reporting 3-6x more private sessions than statistically expected. What's Changed

fix: don't report private on non-Invalid...

Jul 23, 2026

Download .zip

This release significantly cuts down on the false positive rate, particularly on Android. What's Changed

fix: replace Chrome OPFS-flush test with IndexedDB durability-ratio (#65) by @Joe12387 in #66...

May 31, 2026

Download .zip

Fixes Chromium incognito detection w/ new OPFS timing attack method. What's Changed

Replace removed Chrome quota test with OPFS flush timing by @ilkkapeltola in #62

New Contributors

@ilkkapeltola m...

Sep 20, 2025

Download .zip

Adds support for UXP browsers. What's Changed

Make it working for UXP browsers by @hawkeye116477 in #57

New Contributors

@hawkeye116477 made their first contribution in #57

Full Changelog: v1.6.1....