I would like to use vanilla js for this if possible, what I would like to do would be to store data similar to the function localStorage but I want every user that opens the site to see the info.
I really cant find anything online about storing data in this way, I’ve looked at several different websites and used different searches but I can’t find anything on it.
Edit : For those who want to know I am trying to make a chat room with vanilla js that different people can chat in, it does not have to keep all messages, just the latest one.
2
Answers
I think what you’re asking for is some kind of backend/database. If the client is generating the data, it must be transmitted somewhere in order to be shown on other devices. A service such as Cloud Firestore or a hosted database would be a good option for centralized storage, and clients could then query the database to show the shared data.
localStorage is client-side storage. The data is stored in the client’s browser. So I think it would be impossible for other people to see the data.
What I would suggest is you could store the data on a server. Maybe REST API or a BaaS as you preferred. If you still want to use localStorage, you can use it to store the data in the browser as cache for the current user.