joe12387 / detectincognito Goto Github PK
View Code? Open in Web Editor NEWJavaScript detection of Incognito & other private browsing modes on Chrome, Edge, Safari, Brave, Firefox, Opera and MSIE.
License: MIT License
JavaScript detection of Incognito & other private browsing modes on Chrome, Edge, Safari, Brave, Firefox, Opera and MSIE.
License: MIT License
Got this issue
(0 , detectincognitojs__WEBPACK_IMPORTED_MODULE_11__.detectIncognito) is not a function
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
This package mentions moving to a differnet package: https://www.npmjs.com/package/detectincognitojs
But the old package has no such note: https://www.npmjs.com/package/detect-incognito
detectIncognito v1.1.2
Console:
detectIncognito.min.js:6 Uncaught ReferenceError: exports is not defined
at detectIncognito.min.js:6:36
(anonymous) @ detectIncognito.min.js:6
https://cdn.jsdelivr.net/gh/Joe12387/detectIncognito\@main/detectIncognito.min.js
Checking on console, jsHeapSizeLimit
is exactly the same for both private and normal tabs
I'm using firefox 93.0 on macOS and the script is not working on it
With the Ublock Origin Chrome plugin enabled, detectIncognito won't load on my machine. Any thoughts?
I would use this piece of code with a module bundler, and I use typescript with react.
I use Brave in macOS
Version 1.51.114 Chromium: 113.0.5672.92 (Official Build) (arm64)
It doesn't detect incognito nor regular
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);
}
safari 16
iOS 16
iPhone 14 on Xcode simulator
ESbuild
react
typescript
btw awesome package ! work well on chrome and iOS 15
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);
};
};
Do you plan making this a module using promises?
Or I can create a PR with this modification.
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
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?
I see we have a v1.1.0 release on Github. Do we plan to release it on npm too?
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));
}
);
}
navigator.storage.getDirectory().then(ok => {
console.log('not private')
}, err => {
console.log('private')
})
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.
Hi, thank you for the great work! I wonder if it's safe to use eval in this package?
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
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.
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)
Currently, detect-incognito is not detecting Chrome incognito on IOS devices. Do you have some ideas on how to achieve this?
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:
quota
< jsHeapSizeLimit
. Example: 3.99GB quota
and 4GB jsHeapSizeLimit
would get detected as incognitoFirefox can also produce false positives if the user disables Service Workers and Push API
dom.serviceWorkers.enabled
dom.push.enabled
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
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.