Coder Social home page Coder Social logo

maykonn / js-detect-incognito-private-browsing-paywall Goto Github PK

View Code? Open in Web Editor NEW
43.0 11.0 14.0 1.43 MB

Javascript Code to Detect Private or Incognito Browsing (with Bot detector) and Paywall

Home Page: https://www.npmjs.com/package/js-detect-incognito-private-browsing

JavaScript 85.14% HTML 14.86%
incognito private browsing incognito-mode bot-detector javascript js private-browsing incognito-browsing bot

js-detect-incognito-private-browsing-paywall's People

Contributors

feelinc avatar maykonn avatar shoestar avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

js-detect-incognito-private-browsing-paywall's Issues

Does it still work with Chrome?

Does this work in Chrome 78? I just tried it for the first time and while it detects a private session in Firefox, it does not in Chrome.

I also saw a post saying the following,

When asking Google about these two new detection methods, Google has told BleepingComputer that they stand by their statement that they will "work to remedy any other current or future means of Incognito Mode detection."

By the way, it would be convenient if this could be imported like other modules. I'm not sure what the window.BrowsingModeDetector syntax does, though if I change it to export function BrowsingModeDetector()... it appears to import normally, and this is how I tested it.

Issue with webpack

After installing Browsing Mode Detector library as Dev Dependency I'm getting this error on the JS Console:

Uncaught TypeError: js_detect_incognito_private_browsing__WEBPACK_IMPORTED_MODULE_2___default.a is not a constructor

What I did was just, install the library using npm:

npm i -D js-detect-incognito-private-browsing

Then, import it as module in my index.js file:

import BrowsingModeDetector from 'js-detect-incognito-private-browsing'

What am I missing? Am I importing wrong the library?

Store Browsing Mode in a variable

Hi there. I'm developing a library for handle cookies and comply with the European Laws. So, I'm using this the detect incognito library for detecting when a user is navigating on incognito mode. So, after this introduction, I'd like to know if it is possible to store the browsing mode in a variable outside the callback function.
My code looks like:

var browsingModeCallback = function (browsingInIncognitoMode) {
            if (browsingInIncognitoMode && 'true' != Cookies.get( 'ez_accepted' ) ) {
                // Incognito, Private mode detected
                $( '.ez-waiting-img' ).hide();
                $( '.ez-waiting-message' ).hide();
                $( '.ez-waiting-optout' ).show();
                disableCookies();
                return;
            }
        };
        var BrowsingModeDetectorInstance = new BrowsingModeDetector();
        BrowsingModeDetectorInstance.do(browsingModeCallback);

But I need to know the value of browsingInIncognitoMode outside that scope. It is possible? if so, how can I do it?

Thanks.

False positive on Mozila Firefox 65.0.2

False positive private browsing on Mozila Firefox 65.0.2.
If I test the library on a localhost it works as it should but if I test it on a hosted app it always returns true (private browsing) even if the browser is in normal mode.

Help to implement latest Safari & iOS detector

Hi,

Tested in Safari 13 and iOS 13.2

function tryFillLocalStorage (chunkSize) {
  var size = chunkSize / 4; // chunk will be repetition of 4B
  var content = (new Array(size+1)).join('aใ‚');
  var blob = {
    size:     chunkSize,
    payload:  content
  };
  // now is the generated time
  blob.lastModifiedDate = new Date();
  // Name it random so key won't conflict
  blob.name = (~~(Math.random()*100000)+100000)+'.txt';

  try {
    localStorage.setItem(blob.name, JSON.stringify(blob));
  } catch(e) {
    try {
      localStorage.removeItem(blob.name);
    } catch(e) {}

    return false;
  }

  try {
    localStorage.removeItem(blob.name);
  } catch(e) {}

  return true;
}

// normal mode having max 5 MB in localStorage space,
// yes NORMAL MODE having max 5 MB
var LOCAL_STORAGE_DATA_SIZE = 1024 * 1024 * 5; // 5MB

if (tryFillLocalStorage(LOCAL_STORAGE_DATA_SIZE)) {
  // IN PRIVATE MODE
}

Please if you can help implement and optimize that, because I'm currently using a whole different code structure, which support strict mode code.

Also please check this line of code, because you have a typo there.

Thanks.

Issue on Firefox

I implemented this yesterday and it was working fine in Firefox. Cue an update overnight and now it doesn't appear to be. Version of Firefox I'm using is 63.0. Pls advise.

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.