is-incognito-mode

by yankouskia

yankouskia / is-incognito-mode

👤Function to identify whether browser is in incognito mode 👀

127 Stars 5 Forks Last release: Not found MIT License 11 Commits 0 Releases

Available items

No Items, yet!

The developer of this repository has not created any items for sale yet. Need a bug fixed? Help with integration? A different license? Create a request here:

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

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

We use cookies. If you continue to browse the site, you agree to the use of cookies. For more information on our use of cookies please see our Privacy Policy.