Exit
  • Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
  • 한국 커뮤니티
0

Incognito Browser Mode Detection Script

New Here ,
Aug 20, 2018 Aug 20, 2018

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.

Test incognito or private browsing

1.8K
Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Aug 20, 2018 Aug 20, 2018

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"));

}

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
New Here ,
Aug 21, 2018 Aug 21, 2018

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.

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
LEGEND ,
Aug 21, 2018 Aug 21, 2018

Yes, it might work now.  But how long until a browser update breaks it?

V/r,

^ _ ^

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
New Here ,
Aug 21, 2018 Aug 21, 2018

Good point WolfShade

Looks like the only browser I am struggling with is Safari on mac and all browser on ios.

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Aug 21, 2018 Aug 21, 2018

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.

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
New Here ,
Aug 21, 2018 Aug 21, 2018

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

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Aug 21, 2018 Aug 21, 2018

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.

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Aug 21, 2018 Aug 21, 2018

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!

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
LEGEND ,
Aug 21, 2018 Aug 21, 2018
LATEST

Anyone who uses uBlock Origin can right-click the modal overlay and block the element, allowing full article viewing.

V/r,

^ _ ^

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
LEGEND ,
Aug 21, 2018 Aug 21, 2018

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,

^ _ ^

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines