Document.cookie | js cookie timeout
TheDocument[1]propertycookieletsyoureadandwritecookies[2]associatedwiththedocument.Itservesasagetterandsetterfortheactualvaluesofthecookies.Readallcookiesaccessiblefromthislocation[3]allCookies=document.cookie;InthecodeaboveallCookiesisastringcontainingasemicolon-separatedlistofallcookies(i.e.key=valuepairs).Notethateachkeyandvaluemaybesurroundedbywhitespace(spaceandtabcharacters):infact,RFC6265[4]mandatesasinglespaceaftereachsemicolon,butsomeuseragentsmaynotabidebythis.Writeanewcookie[5]doc...
The Document[1] property cookie lets you read and write cookies[2] associated with the document. It serves as a getter and setter for the actual values of the cookies.
Read all cookies accessible from this location[3]allCookies = document.cookie;In the code above allCookies is a string containing a semicolon-separated list of all cookies (i.e. key=value pairs). Note that each key and value may be surrounded by whitespace (space and tab characters): in fact, RFC 6265[4] mandates a single space after each semicolon, but some user agents may not abide by this.
Write a new cookie[5]document.cookie = newCookie;In the code above, newCookie is a string of form key=value, specifying the cookie to set/update. Note that you can only set/update a single cookie at a time using this method. Consider also that:
Any of the following cookie attribute values can optionally follow the key-value pair, each preceded by a semicolon separator: ;domain=domain (...