Compatibility: In case local storage is disabled or unavailable
Opened this issue · 0 comments
goobemaster commented
This has been bugging me for the last few days. In theory local storage is widespread now in modern browsers. But what is the guarantee that its enabled, available or otherwise readily usable?
- Instead of blindly using the local storage in CachedJSONData, it should be verified that its indeed available.
- If its not available, then the data should be loaded to the memory.
- If its not available, then persistent user data (e.g. score, level) should be saved to a cookie.
Now, cookies are deemed to be the enemy these days, so another fallback may be needed, like:
Informing the user that all attempts failed to persistently save their data, so pretty please enable the local storage or cookies - otherwise they need to start the game from level 1 every time. :)