Ok, so lets say I want to use cookies to save my game stats? | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 5

Ok, so lets say I want to use cookies to save my game stats?

Is this feasible in JS? or would I be better off trying to reference to a database and save the info server side? Here's the game I want to save stats from. https://code.sololearn.com/WaqGLukwdd5x/?ref=app

23rd May 2017, 7:58 PM
Russel Reeder
Russel Reeder - avatar
10 Answers
+ 5
https://www.w3schools.com/js/js_cookies.asp
23rd May 2017, 8:40 PM
Russel Reeder
Russel Reeder - avatar
+ 4
oddly enough, cookies seem to work on the website playground, but not the mobile playground... same with localStorage. Seems a database will be the best concept...
24th May 2017, 4:42 AM
Russel Reeder
Russel Reeder - avatar
+ 4
Thanks, I'll check it out. I have a site at 000webhost.com, I had a PHP forum on the same host before, not sure if it can do nodejs tho
24th May 2017, 8:43 AM
Russel Reeder
Russel Reeder - avatar
+ 3
Good insights
24th May 2017, 4:05 AM
Russel Reeder
Russel Reeder - avatar
+ 3
that's because the app's webview component doesn't have same permissions/capabilities the browser has. Smae goes if you want to access cameras/microphone/geolocation/vibration etc...
24th May 2017, 8:29 AM
seamiki
seamiki - avatar
+ 3
Hmm. Well I'm studying Node.js, gonna see if that will have a workaround so it will be compatible on mobile. Seems promising
24th May 2017, 8:34 AM
Russel Reeder
Russel Reeder - avatar
+ 3
seems to do the job... time to read up
24th May 2017, 8:47 AM
Russel Reeder
Russel Reeder - avatar
+ 2
I think it's doable but, what if the user clears cookies? What if the user switches between mobile and desktop browsers? If these issues are fine for you, why not?
24th May 2017, 4:04 AM
seamiki
seamiki - avatar
+ 2
Sorry, it was "scoreboard" here's Burey's tutorial. https://code.sololearn.com/Wb3UALD0atIG/?ref=app
24th May 2017, 8:39 AM
seamiki
seamiki - avatar
+ 1
heroku has some free options if you want to deploy your nodejs server. Expect limitations but for testing and simple user checkpoints should be good enough. Check out Burey's leaderboard if you want to go with firebase db
24th May 2017, 8:37 AM
seamiki
seamiki - avatar