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!
发布者:admin,转转请注明出处:http://www.yc00.com/questions/1745454295a4628413.html
评论列表(0条)