Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

Why does the browser pretend to have localstorage but then throw an exception when it's used?

Surely it would be better to simply pretend to not support localstorage and then all sites built with feature detection would work correctly without needing to special case this?



I can see it both ways. I think there's an opportunity for the developer to identify that localStorage is unavailable at runtime, and turn off certain features in the UI as a result, or write their own wrapper layer that does the 'throw-away' behavior.




Consider applying for YC's Winter 2026 batch! Applications are open till Nov 10

Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: