Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/yankouskia/is-incognito-mode
👤Function to identify whether browser is in incognito mode 👀
https://github.com/yankouskia/is-incognito-mode
browser incognito incognito-mode javascript private-api private-mode tricky
Last synced: about 2 months ago
JSON representation
👤Function to identify whether browser is in incognito mode 👀
- Host: GitHub
- URL: https://github.com/yankouskia/is-incognito-mode
- Owner: yankouskia
- License: mit
- Created: 2019-05-20T20:10:37.000Z (over 5 years ago)
- Default Branch: master
- Last Pushed: 2023-01-03T22:26:14.000Z (over 1 year ago)
- Last Synced: 2024-07-16T20:16:18.126Z (2 months ago)
- Topics: browser, incognito, incognito-mode, javascript, private-api, private-mode, tricky
- Language: JavaScript
- Homepage: https://yankouskia.github.io/is-incognito-mode/example/index.html
- Size: 1.15 MB
- Stars: 129
- Watchers: 4
- Forks: 7
- Open Issues: 15
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
[![PRs Welcome](https://img.shields.io/badge/PRs-welcome-brightgreen.svg)](https://github.com/yankouskia/is-incognito-mode/pulls) [![GitHub license](https://img.shields.io/badge/license-MIT-blue.svg)](https://github.com/yankouskia/is-incognito-mode/blob/master/LICENSE)
[![NPM](https://nodei.co/npm/is-incognito-mode.png?downloads=true)](https://www.npmjs.com/package/is-incognito-mode)
# is-incognito-mode
👤Function to identify whether browser is in incognito mode 👀
## How to use
To install library:
```sh
# yarn
yarn add is-incognito-mode# npm
npm install is-incognito-mode --save
``````js
// 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](https://yankouskia.github.io/is-incognito-mode/example/index.html)
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](https://github.com/yankouskia/is-incognito-mode/blob/master/LICENSE)