Skip to content
👤Function to identify whether browser is in incognito mode 👀
Branch: master
Clone or download
Permalink
Type Name Latest commit message Commit time
Failed to load latest commit information.
dist update get-browser to correctly identify chromium May 23, 2019
example update readme, links, example May 21, 2019
resources ready to identify incognito mode 👀 May 21, 2019
.editorconfig ready to identify incognito mode 👀 May 21, 2019
.gitignore ready to identify incognito mode 👀 May 21, 2019
.npmignore
LICENSE Initial commit May 20, 2019
README.md update readme, links, example May 21, 2019
index.js update firefox firing callback May 28, 2019
package.json update firefox firing callback May 28, 2019
webpack.config.js update readme, links, example May 21, 2019
yarn.lock update get-browser to correctly identify chromium May 23, 2019

README.md

PRs Welcome GitHub license

NPM

is-incognito-mode

👤Function to identify whether browser is in incognito mode 👀

How to use

To install library:

# yarn
yarn add is-incognito-mode

# npm
npm install is-incognito-mode --save
// ES6 modules
import isIncognito from 'is-incognito-mode';

// CommonJS modules
const isIncognito = require('is-incognito-mode').default;

/*
  Function returns Promise, which could be:
  - resolved with true, if Incognito mode is opened
  - resolved with false, if regular window is opened
  - rejected if no possibility to identify
*/
isIncognito()
  .then(isPrivate => {
    if (isPrivate) {
      alert('There is no porn! Why are you using Incognito mode?');
    } else {
      console.log('Incognito mode is NOT activated')
    }
  })
  .catch(e => {
    console.log(e.message);
  })

Demo

DEMO can be found here

Incognito Window Regular Window

API

isIncognito: Promise<boolean>

Result Promise is

  • resolved with true, if Incognito mode is opened.
  • resolved with false, if regular window is opened
  • rejected if no possibility to identify

Contributing

is-incognito-mode is open-source library, opened for contributions

License

is-incognito-mode is MIT licensed

You can’t perform that action at this time.