Jump to content
  • Advertisement
Sign in to follow this  
Lode

JavaScript local storage

This topic is 2151 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

Hello,

 

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
Advertisement

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 GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

GameDev.net 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!