Incognito Browser Mode Detection Script
Copy link to clipboard
Copied
I've looked all over the web and no one has seemed to figure out how to detect incognito on the Mac. All the scripts I have tested work on PC only. Has anyone figured this out? Here is an example of one working on PC.
Copy link to clipboard
Copied
What are you hoping to accomplish? There might be another way to test what you want to test or protect your site if we better understand your situation.
If you wanted to detect Chrome, you could use this to detect the FileSystemAPI which is disabled in incognito mode and use that. If you are trying to go after a particular browser instead of an OS that could help us too because the ways to detect at times could be browser specific and not OS specific:
var fs = window.RequestFileSystem || window.webkitRequestFileSystem;
if (!fs) {
console.log("check failed?");
} else {
fs(window.TEMPORARY,
100,
console.log.bind(console, "not in incognito mode"),
console.log.bind(console, "incognito mode"));
}
Copy link to clipboard
Copied
Thanks Ben,
What I am working on is firing a lightbox modal when a user is browsing incognito mode. The script I am using works in all browsers on PC. Chrome, Firefox, Edge etc. Just not on a Mac or iphone. I will give your script a shot. I will let you know shortly the outcome. WolfShade​
As you can see it works here
Testing Incognito Browser Recognition - Articles - Bucks County Courier Times - Levittown, PA
(Modal shows when incognito, might need to refresh on icognito mode to see result). On PC browsers only.
Copy link to clipboard
Copied
Yes, it might work now. But how long until a browser update breaks it?
V/r,
^ _ ^
Copy link to clipboard
Copied
Good point WolfShade
Looks like the only browser I am struggling with is Safari on mac and all browser on ios.
Copy link to clipboard
Copied
Craig you are correct that this is Safari Mac/iOS issue and not all Mac browsers. To wolf's point, he is correct that you are fighting an uphill battle here. Are you trying to setup a paywall or simply just a modal window on the page? If it is a paywall based on authentication there are other ways to try and identify whether someone has credentials or try to limit traffic from sources if you feel they are trying to get in for free. Obviously someone will always try to find a way in but you can try to do as much as you can in that respect, but I don't think blocking incognito mode or throwing up content specifically at that is the way to go about this.
Copy link to clipboard
Copied
Thanks Ben, just modal.
Boston Globe does a pretty good job at blocking users incognito. Officials believe body of Iowa student Mollie Tibbetts found - The Boston Globe
Copy link to clipboard
Copied
No, they really don't do a good job.
Anyone who regularly uses incognito mode, and runs into their little attempted overlay, can easily negate it by changing the display setting of the overlay to "none" in the browser's Developer Tools.
That overlay is nothing more than a momentary annoyance to anyone who regularly tries to actively protect their privacy online.
Copy link to clipboard
Copied
I agree with Jon, their paywall is not very efficient at all. I was able to see the Boston Globe article by just disabling javascript on the pages. Worked in incognito mode and regular mode. I was able to read their articles just fine!
Copy link to clipboard
Copied
Anyone who uses uBlock Origin can right-click the modal overlay and block the element, allowing full article viewing.
V/r,
^ _ ^
Copy link to clipboard
Copied
Companies that make browsers make incognito modes better every time someone figures a way to detect incognito mode. It's a vicious circle, one that will keep you researching the newest hack every time they thwart your desire to detect incognito mode.
Why bother?
V/r,
^ _ ^

