sets cookies with attributes specified by the association assoc, to be used by functions such as URLExecute.


sets a list of cookies.


  • In SetCookies[assoc], the following entries can appear in the association, with the same possible values as in $Cookies:
  • "Domain"domain for the cookie
    "Path"path restriction within the domain
    "Name"name of the cookie
    "Content"content of the cookie
    "ExpirationDate"when the cookie is set to expire
    "CreationDate"when the cookie was created
    "AllowSubdomains"whether to send cookies to subdomains (HostOnly)
    "ConnectionType"for what connection type the cookie should be sent (Secure)
    "ScriptAccessible"whether cookie is accessible from JavaScript etc. (HttpOnly)
  • "ExpirationDate"->Automatic indicates that a cookie is for this session only, and is not persistent.
  • SetCookies can set both session cookies and persistent cookies.
  • All cookies that have been set are reflected in the list $Cookies. Information on persistent cookies is stored in the location specified by $CookieStore.


open allclose all

Basic Examples  (1)

View currently set cookies:

Set cookies for a domain:

The cookies are stored in $Cookies for later use:

Applications  (2)

URLRead and related functions process cookie requests from the server:

If there is a matching cookie in $Cookies, no request is made by the server:

ClearCookies removes cookies:

Those cookies can be later restored using SetCookies:

Wolfram Research (2016), SetCookies, Wolfram Language function,


Wolfram Research (2016), SetCookies, Wolfram Language function,


Wolfram Language. 2016. "SetCookies." Wolfram Language & System Documentation Center. Wolfram Research.


Wolfram Language. (2016). SetCookies. Wolfram Language & System Documentation Center. Retrieved from


@misc{reference.wolfram_2024_setcookies, author="Wolfram Research", title="{SetCookies}", year="2016", howpublished="\url{}", note=[Accessed: 22-May-2024 ]}


@online{reference.wolfram_2024_setcookies, organization={Wolfram Research}, title={SetCookies}, year={2016}, url={}, note=[Accessed: 22-May-2024 ]}