Quiz
- Can we talk more about keys in location storage and what if conflicts happen?
Sure. Your browser's localstorage could be used by any page/app that you visit. They all have to get along.
It's useful to know that, like cookies, the localStorage is divided by origin (essentially, the server that you are talking to). So you don't have to worry about other apps from other sites.
But suppose there's an online games site. If the Bloons game saves your statistics under
stats
and the Zork app saves your statistics understats
, well, that's a disaster. But if they saved the status underbloons_stats
andzork_stats
, that works.In the final project, your apps will save some data in localstorage, and I'll be grading all of your apps, which means my browser will visit all your pages, and they will all be hosted on
cs.wellesley.edu
. If you all save your data underapp_data
, that's a similar disaster.So, apps should try to get along by storing data under names that are less likely to conflict.