Advertisement Jump to content
Sign in to follow this  

JavaScript local storage

This topic is 1871 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts



I know it's not C++, but JavaScript is useful for game programming too :)


The simplest way I know to store some state with JavaScript is to store it in a cookie. However, this has the disadvantage than then the cookie is sent with every HTTP request, and I wouldn't want players to send their local game state to every single page of my website, it's a bandwidth waste.


HTML5 local storage however seems to be a messy subject, with browsers using different standards (some of which are SQL which seems overkill to me).


Is there a good way you can recommend  to have local storage that is compatible with most browsers (at least Firefox, Chrome and IE, and browsers on phones would be nice too), is lightweight, and works per-url or per-website? (like cookies are per domain which is good enough)

Thanks a lot!

Share this post

Link to post
Share on other sites

The second option, local-storage is so awesome and simple! Thanks! I think I just was confused by the other options and missed this simple but widely supported one.

Share this post

Link to post
Share on other sites
Sign in to follow this  

  • Advertisement

Important Information

By using, you agree to our community Guidelines, Terms of Use, and Privacy Policy. is your game development community. Create an account for your GameDev Portfolio and participate in the largest developer community in the games industry.

Sign me up!