Code Monkey home page Code Monkey logo

detectincognito's People

Contributors

deokti avatar joe12387 avatar michaelkolesidis avatar mykolashevchuk avatar napthedev avatar p810 avatar surferjeff avatar toxic-johann avatar xiren7 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  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  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  avatar  avatar  avatar  avatar  avatar  avatar  avatar

detectincognito's Issues

iPhone QR Code scanner

Hi,
Thanks for your great work.

There is one case I'm not sure how you see it, but would help me and possibly many others a LOT:
When opening an URL from the camera app, it will open in normal Safari, either in normal or private mode (whatever was last opened). But when scanning a QR code from the quick access menu (Control Center) shortcut, it will open some single browser window without a URL bar. And this window will not share it's session with Safari, meaning that if someone is authenticated in Safari, he will not be authenticated in this session, which seems to me to be very similar like being in Incognito mode.
Is this something your script could detect as well?
Thank you

TypeError: undefined is not an object (evaluating 'iframe.contentWindow.applicationCache.addEventListener') on iOS 16

error

image

code

try {
    const result = await detectIncognito();

    if (result.isPrivate) {
      alert(
        'using private mode',
      );
      window.addEventListener('beforeunload', (e) => {
        e.preventDefault();
        e.returnValue =
          'using private mode';
      });
    }
  } catch (error) {
    console.error(error);
  }

environment

safari 16
iOS 16
iPhone 14 on Xcode simulator

code base

ESbuild
react
typescript


btw awesome package ! work well on chrome and iOS 15

Firefox displays incorrect isPrivate value when the site URL is HTTP

OS:- MacOs ventura(13.2.1)
Browser: Firefox(113.0.1)

When the site URL is HTTP, the isPrivate value is incorrectly displayed as true instead of false in normal mode.

Solution:

const firefoxPrivateTest = () => {
  const db = indexedDB.open('test');

    db.onerror = function () {
      __callback(true);
    };
    db.onsuccess = function () {
      __callback(false);
    };
};

Error: File '/node_modules/detectincognitojs/dist/detectIncognito.d.ts' is not a module.ts(2306)

I install the package, I follow the instructions and I try to import it

import { detectIncognito } from "detectincognitojs";

And I get an error:

File '/node_modules/detectincognitojs/dist/detectIncognito.d.ts' is not a module.ts(2306)

I am using create-react-app with the TypeScript template

I have also created a minimal reproducible example, an empty test project and when I tried to import it, I had the exact same problem.

The previous version (1.1.2) works fine, the error only occurs in the latest version (1.2.0).

Version: 1.2.0
Browsers: All

Doesn't work on Safari 16.0 on MacOS and Mobile

Hello and thank you for your job! But the last update of safari crashes everything. On 1.1.1 it doesn't work and even doesn't throw any errors on safari 16.0. Do you have some thoughts about it? Can you fix it?

check error Chrome 107.0.5304.108

image

function storageQuotaChromePrivateTest() {
      navigator.webkitTemporaryStorage.queryUsageAndQuota(
        function (usage, quota) {
          console.log(quota, getQuotaLimit()); // 1119775232 1098907648
          _resolveFn(quota < getQuotaLimit());  // false
        },
        function (e) {
          reject(new Error("detectIncognito somehow failed to query storage quota: " + e.message));
        }
      );
    }

new/easier safari method

navigator.storage.getDirectory().then(ok => {
  console.log('not private')
}, err => {
  console.log('private')
})

macOs Safari 15 automated tests detected as Private Mode

Hello,
thank's for your job. It is currently the only library that works on all versions of all major vendors.

In my job I have to integrate the control on the verification of the private mode through automated tests using webdriver.io and selenium-standalone.
While testing with Safari 15 on macOS I found that the library detects the browser as private mode even though it is not.
For other browsers such as Chrome, Firefox and Edge / IE the detection occurs correctly.

chrome/v8 106+ support

106's update comes with jsHeapSizeLimit matching incongnito and normal browsing. Arms race continues.. I will update if I find a new way... any ideas are welcome

Vivaldi always shows as isPrivate

I use Vivaldi and it is a Major boon to my workflow, However, we need to stop incognito in browsers for most of our pages. Unfortunately this also throws Vivaldi users under the bus. We have tried several of the work-arounds that no longer work with the current version of Vivaldi.

This is probably a know issue, but would appreciate feedback.

Email broken?

Trying to send you an email, but...

<[[email protected]](mailto:[email protected])>: host aspmx.l.google.com[142.250.27.27] said: 550-5.1.1 The
    email account that you tried to reach does not exist. Please try 550-5.1.1
    double-checking the recipient's email address for typos or 550-5.1.1
    unnecessary spaces. Learn more at 550 5.1.1
    https://support.google.com/mail/?p=NoSuchUser
    gb41-20020a170907962900b0078db6f56d51si11074896ejc.808 - gsmtp (in reply to
    RCPT TO command)

False positives

From what I see, the Chrome detection is based on storage quota < physical memory from here, but this condition is not exclusive to incognito mode. It's also in:

  • Guest mode
  • Privacy and security settings
    • Clear cookies and site data when you close all windows
    • Sites that clear cookies when you close them
  • Anytime storage quota < jsHeapSizeLimit. Example: 3.99GB quota and 4GB jsHeapSizeLimit would get detected as incognito

Firefox can also produce false positives if the user disables Service Workers and Push API

  • dom.serviceWorkers.enabled
  • dom.push.enabled

firefox 108.0 is not correct when http access

my firefox is not in private mode, but i access web page with http, when i get navigator.serviceWorker, it is undefined, and it will be judged to be private mode.

the firefox version is 108.0

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.