HTTP cookie: Difference between revisions

Content deleted Content added
No edit summary
Tags: Visual edit Mobile edit Mobile web edit
Reverted 1 edit by Donnadonna195 (talk): Revert unexplained removal of content. (TW)
Line 120:
 
The server responds with two <code>Set-Cookie</code> headers:
 
<syntaxhighlight lang="http">
HTTP/1.0 200 OK
Content-type: text/html
Set-Cookie: theme=light
Set-Cookie: sessionToken=abc123; Expires=Wed, 09 Jun 2021 10:18:14 GMT
...
</syntaxhighlight >
 
The server's HTTP response contains the contents of the website's homepage. But it also instructs the browser to set two cookies. The first, "theme", is considered to be a "session" cookie, since it does not have an Expires or Max-Age attribute. Session cookies are intended to be deleted by the browser when the browser closes. The second, "sessionToken" contains an "Expires" attribute, which instructs the browser to delete the cookie at a specific date and time.