4 ms·
I wonder if they'll ever fix `localStorage` in private Safari windows. It breaks countless sites and Safari is the only browser to block it.
by erichurkman 8y ago
I wonder if they'll ever fix `localStorage` in private Safari windows. It breaks countless sites and Safari is the only browser to block it.
- janlukacs 8y agoI love Safari, it's my main browser - but there are so many small annoying things that take ages to fix it's just sad.
- madeofpalk 8y agoAny site that is broken by Private Browsing causing storage quota exceptions in localStorage is going to be broken by quota exceptions under "normal" operation. It's in the spec, maybe developers should make their websites a bit more resilient to the very real errors that can happen? Did they just forget about error handling?
- rasz 8y agospec? localstorage errors are not standardized, every browser gives quota exceeded error different name and number, you have to use something like '' e.name.toLowerCase().includes("quota")
- madeofpalk 8y agoBut localStorage.setItem() throwing an error definitely is in the spec, so if someone isn't handling Safari's localStorage behaviour in Private Browsing Mode (that is, throwing exceptions) then they aren't handling the parts of the spec.
- strictnein 8y agoThe web isn't built on specs, it's built on conventions. Safari breaks the convention.
- madeofpalk 8y agothe convention is that localStorage throws exceptions. it does in every browser. if a site breaks because it doesn't do error handling, then that's the site's problem.
- xmodem 8y agoYou and many of the commenters miss an important point: Any apparent behaviour difference between private and non-private mode should be considered a bug, because sites can and do abuse it to detect private mode.
- madeofpalk 8y agoI disagree. You might be able to use it to _guess_ but all browsers can throw a quota exceeded exception under normal behaviour. I see this every now and then on mobile devices where the phone is so full the browser refuses to store more localStorage items.
- xmodem 8y agoThis is exactly what I want to prevent though - I want to prevent dodgy sites from using the quota exceeded exceptions from localStorage to (100% accurately in my experience) guess that I'm browsing in private mode.
- Ambroos 8y agoChrome with certain privacy-conscious settings disallows access to localStorage as well. It broke something we built too.
- Jach 8y agoThere's also a security policy that affects IE11, accessing localStorage ends up giving an "Access is Denied" error...
- TheAceOfHearts 8y agoI too wish they provided an ephemeral localStorage in private browsing. But in any case, your application should be interacting with localStorage through an in-memory facade, otherwise it's still going to break with lots of other edge-cases. All operations should be treated as volatile, and probably silently suppressed on failures. Using a facade also makes testing easier, and if you avoid global side-effects it becomes easier to parallelize test-cases.