To install library:
# yarnyarn add is-incognito-mode# npmnpm install is-incognito-mode --save
// ES6 modulesimport isIncognito from 'is-incognito-mode';// CommonJS modulesconst 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); })
Incognito Window | Regular Window |
---|---|
![]() | ![]() |
isIncognito: Promise<boolean>
Result Promise
is
truefalse
is-incognito-mode
is open-source library, opened for contributions
is-incognito-mode
is MIT licensed