Coder Social home page Coder Social logo

vladimyr / is-incognito-mode Goto Github PK

View Code? Open in Web Editor NEW

This project forked from yankouskia/is-incognito-mode

0.0 2.0 0.0 252 KB

👤Function to identify whether browser is in incognito mode 👀

Home Page: https://yankouskia.github.io/is-incognito-mode/example/index.html

License: MIT License

HTML 25.07% JavaScript 72.29% TypeScript 2.63%

is-incognito-mode's Introduction

Travis (.com) 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');

/*
  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

is-incognito-mode's People

Contributors

vladimyr avatar

Watchers

 avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.