1

Spent lot of time searching on the net to find a way to detect firefox private mode, could not find any hacks. I want to detect private mode because firefox tracking protection which is enabled by default is blocking a rest call to my api from my js application, so I want to detect private mode and display a proper message to the user.

aryanRaj_kary
  • 503
  • 2
  • 7
  • 28

1 Answers1

-1

This seems to work in Firefox. I got it from this question. Look at this answer by Jez

try {
  // try to use localStorage
  localStorage.test = 2;        
} catch (e) {
  // there was an error so...
  alert('You are in Privacy Mode\nPlease deactivate Privacy Mode and then reload the page.');
}

Apart from this, I think there is no way now, with modern browsers, to detect whether the user is using Privacy Mode and rightly so. That's why browsers have tried to shut off any way of detecting this using javascript or css.

Community
  • 1
  • 1
Mohit Bhardwaj
  • 9,650
  • 3
  • 37
  • 64