iim
is-incognito-mode
npm i is-incognito-mode
iim

is-incognito-mode

👤Function to identify whether browser is in incognito mode 👀

by Aliaksandr Yankouski

1.1.0 (see all)License:MITTypeScript:Not Found
npm i is-incognito-mode
Readme

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 WindowRegular 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

Downloads/wk

2

GitHub Stars

127

LAST COMMIT

2yrs ago

MAINTAINERS

1

CONTRIBUTORS

2

OPEN ISSUES

2

OPEN PRs

10
VersionTagPublished
1.1.0
latest
4yrs ago
No alternatives found
No tutorials found
Add a tutorial
No dependencies found

Rate & Review

100
No reviews found
Be the first to rate