News for hackers. Stuff that matters.

Ask HN: How does this website know I'm in incognito mode?

When I try to view this page [1] in incognito mode it says, "You must exit incognito mode to read the content". How does it know I'm in incognito mode?

[1] https://www.technologyreview.com/s/429438/dear-everyone-teaching-programming-youre-doing-it-wrong/

( 4 comments | 4 points | on HN )
Re:Ask HN: How does this website know I'm in incognito mode? by phillipseamore on Friday October 26, 2018 @07:52PM (#18313538)
From looking at the source code they are using some mixture of these:

https://github.com/Maykonn/js-detect-incognito-private-brows...

https://gist.github.com/matyasfodor/15e8863ab15baf4791a5fa4c...

And FYI in Chrome it's very easy to just F12, Application tab, Clear storage in the left menu and "Clear site data" at the bottom on the right to get past all these "you've read too much" blockers.

Re:Ask HN: How does this website know I'm in incognito mode? by samjanis on Friday October 26, 2018 @06:47PM (#18313255)
Just tried using Firefox Quantum 62.2.2 on Debian with different configurations - NoScript enabled and disabled, and tracking protection enabled and disabled. Can't seem to replicate what you're getting.

What browser and OS are you using? Do you have any plugins/extensions active? (Ad blockers, etc. I don't run any, NoScript does a better job.)

Re:Ask HN: How does this website know I'm in incognito mode? by MarkMc on Friday October 26, 2018 @11:16PM (#18314176)
Seems to happen in Chrome for Mac and Android. No extensions or plugins.
Re:Ask HN: How does this website know I'm in incognito mode? by samjanis on Saturday October 27, 2018 @12:12AM (#18314310)
Gotcha. Turns out to be Chrome (or Chromium) specific.

In article.js loaded with this page there is a section that looks like:

dataLayer.push({event:"mittr:detectIncognitoMode",action:"detect",category:"incognito-mode",label:n})

Commenting out the function block surrounding it where it starts with "function y() {..." stops the class ".incognito-wall-shown" from being applied to "section.incognito-wall" found in the main HTML page - although this is just a quick dig and haven't debugged any further (I'm halfway through something else but this caught my interest ;) )