Page 1 of 1
How to save user preference for my game in Cookies ?
Posted: 27 May 2021, 08:11
by bidulpik
Hi,
I've got problem saving the user game preference in cookies.
It works fine in studio.boardgamearena.com, I can easily restore cookies information, but I doesnt work in
https://boardgamearena.com
In prod platform, some cookies are writtent in
and my cookies are written in
I've tried to save it in .boardgamearena.com with javascript or dojo framework, but I didnt succeed.
I want Javascript (or dojo) to get my cookie information.
any idea ?
all the best
Re: How to save user preference for my game in Cookies ?
Posted: 27 May 2021, 10:32
by robinzig
Just a maybe tangential suggestion, but can't you use localstorage rather than cookies? It's generally a cleaner/nicer way to save things on the client side between sessions.
Re: How to save user preference for my game in Cookies ?
Posted: 27 May 2021, 10:46
by bidulpik
> It's generally a cleaner/nicer way to save things on the client side between sessions.
Can I do that ?
The only way a browser save data on the client side, is to use cookie, isnt it ?
There are many options in my game, and players will need to keep there option configuration from one game to another.
I can store it in the game DB, but could I have access to the database of previous game for a specific player player ?
Can I have access to player DB fields I could consult on each game ?
all the best,
bdk
Re: How to save user preference for my game in Cookies ?
Posted: 27 May 2021, 11:38
by thoun
As he said, localStorage will do just that (same as cookie but not sent to servers), it's better than cookies for your use.
LocalStorage will only apply for the device (but it would be the same for cookies). If you want preferences to apply on every device your user have, check framework preferences file.
Re: How to save user preference for my game in Cookies ?
Posted: 27 May 2021, 12:45
by bidulpik
Aaah, ok thank you both of you
I didnt know about local storage
https://developer.mozilla.org/fr/docs/W ... calStorage
i'll try it
Re: How to save user preference for my game in Cookies ?
Posted: 27 May 2021, 15:30
by Tisaac
Do you want the preference to be saved accross devices ?
Because if that's the case, you need a user preference ! (check gameoptions.php in doc)