Is this a Private Browsing window?
Checking…
What it is
Efficiently detect Incognito mode and other private browsing modes across most modern browsers. MIT licensed, open source.
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
- Private Window detection in Opera
Install
npm
npm i detectincognitojsjavascript
import { detectIncognito } from "detectincognitojs";
detectIncognito().then((result) => {
console.log(result.browserName, result.isPrivate);
});CDN — may be blocked by adblockers:
html
<script src="https://cdn.jsdelivr.net/gh/Joe12387/detectIncognito@main/dist/es5/detectIncognito.min.js"></script>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 are not detected by this.
- The script must run over HTTPS — running locally or over HTTP might fail.
- Brave and uBlock Origin block the CDN; bundling or self-hosting the script avoids this.
- An error is thrown if the browser cannot be identified.
Links
Similar projects
- OverpoweredJS — an advanced browser fingerprinting and bot detection solution.
- Established Emails — a positive email reputation API for fraud teams that can determine the minimum age of billions of emails.