I am making a javascript game and in order to save progress I am implementing cookies. I have looked at many tutorials but I cant seem to find one that just saves a variable and then gets the variable from the cookie at a later time only if there is a cookie on the users system. Does anyone know how to implement this? Thanks!
Requirements:
Creates a cookie containing multiple variables
Access the cookie at a later time
Thats it! Thanks!
I am making a javascript game and in order to save progress I am
Share
https://github.com/carhartl/jquery-cookie
Usage:
Create session cookie:
Create expiring cookie, 7 days from then:
Create expiring cookie, valid across entire site:
Read cookie:
Delete cookie:
Note: when deleting a cookie, you must pass the exact same path, domain and secure options that were used to set the cookie, unless you’re relying on the default options that is.