Skip to content

Instantly share code, notes, and snippets.

@JohnAllsopp
Created December 13, 2011 06:59
Show Gist options
  • Save JohnAllsopp/1470989 to your computer and use it in GitHub Desktop.
Save JohnAllsopp/1470989 to your computer and use it in GitHub Desktop.
Private Browsing and localStorage - different browsers handle it differently
What happens to localStorage when different browsers are in private browsing mode?
Safari returns null for any item set using localStorage.setItem either before or during the private browsing session. In essence, neither sessionStorage or localStorage are available in private brosing mode
Chrome and Opera return items set previous to private ("incognito") browsing, but once private browsing commences, treats localStorage like sessionStorage (only items set on the localStorage by that session will be returned) but like localStorage for other private windows and tabs
Firefox, like Chrome will not retrieve items set on locaStorage prior to a private session starting, but in private browsing treats localStorage like sessionStoroage for non private windows and tabs, but like localStorage for other private windows and tabs
@ubermensh
Copy link

chrome and Opera return items set previous to private ("incognito") browsing
that means you can get data set in normal mode from incognito? is that possible? how?

@iamlux
Copy link

iamlux commented Apr 25, 2019

What about in edge browser? How it handles?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment