admin管理员组文章数量:1429488
I am writing a Quiz Application and require JavaScript mechanisms to temporarily store data without utilizing MySQL or an Internet Connection. The Game is a Standalone application. What techniques or libraries may be useful for such an application to store game data temporarily in the particular instance of running the JS functionality.
Please provide any references that may be useful.
Much appreciated
I am writing a Quiz Application and require JavaScript mechanisms to temporarily store data without utilizing MySQL or an Internet Connection. The Game is a Standalone application. What techniques or libraries may be useful for such an application to store game data temporarily in the particular instance of running the JS functionality.
Please provide any references that may be useful.
Much appreciated
Share Improve this question asked Sep 25, 2014 at 2:18 MpatapoMediaMpatapoMedia 111 silver badge11 bronze badges 2- 3 You can use localStorage. – jpcanamaque Commented Sep 25, 2014 at 2:20
- Just answered a similar question today: stackoverflow./a/26026430/965907 – Shomz Commented Sep 25, 2014 at 2:20
3 Answers
Reset to default 3If you don't need your data to stay after you leave the page, consider using sessionStorage.
Otherwise, you're fine with localStorage, like I said in the ment, here is a very related answer: https://stackoverflow./a/26026430/965907
You can use cookies, but localStorage is a bit more modern and provides several advantages. See https://developer.mozilla/en-US/docs/Web/Guide/API/DOM/Storage for a list of storage options in modern browsers.
localStorage and sessionStorage are very similar, and I'd suggest you just use localStorage. See HTML5 Local storage vs. Session storage for a broader discussion.
Maybe you can use javascript cookies. With them you can keep information with a name for as long as you would like. sessionStorage and localStorage are harder to understand and add to your page, but if you are an expert then you could use those. But as I said, I would remend using cookies.
Good luck with your work!
本文标签: jqueryJavaScript Temporary StorageStack Overflow
版权声明:本文标题:jquery - JavaScript Temporary Storage - Stack Overflow 内容由网友自发贡献,该文观点仅代表作者本人, 转载请联系作者并注明出处:http://www.betaflare.com/web/1745454295a2659029.html, 本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容,一经查实,本站将立刻删除。
发表评论