4 ms·
spec? localstorage errors are not standardized, every browser gives quota exceeded error different name and number, you have to use something like '' e.name.to
by rasz 8y ago
spec? 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.