Local Storage + Private Browsing

We’re using localStorage to store a token to let a user interact with a quiz (answering only once). It works great as a no signup solution that let’s us track whether a user has answered before!

The only problem is, private browsing blocks localStorage (particular problem on mobile devices).

  • Could we detect private browsing and get the user to turn it off?
  • Or is there a better way than using localStorage to track a non registered user’s progress even with private browsing turned on?

Currently there is no reliable method for testing if a browser is in private browsing mode. See this stack overflow answer for more details. The whole point of private mode is that once the tab or session is closed, all data is erased, trying to circumvent this will only give your problems.

For my own experience I think that any person that uses private browsing mode on a regular basis is aware that nothing is saved and so would not expect sessions to persist between uses without logging in.