SetCookies

SetCookies[assoc]

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

SetCookies[{assoc1,assoc2,}]

sets a list of cookies.

Details

  • 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.

Examples

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, https://reference.wolfram.com/language/ref/SetCookies.html.

Text

Wolfram Research (2016), SetCookies, Wolfram Language function, https://reference.wolfram.com/language/ref/SetCookies.html.

CMS

Wolfram Language. 2016. "SetCookies." Wolfram Language & System Documentation Center. Wolfram Research. https://reference.wolfram.com/language/ref/SetCookies.html.

APA

Wolfram Language. (2016). SetCookies. Wolfram Language & System Documentation Center. Retrieved from https://reference.wolfram.com/language/ref/SetCookies.html

BibTeX

@misc{reference.wolfram_2024_setcookies, author="Wolfram Research", title="{SetCookies}", year="2016", howpublished="\url{https://reference.wolfram.com/language/ref/SetCookies.html}", note=[Accessed: 25-November-2024 ]}

BibLaTeX

@online{reference.wolfram_2024_setcookies, organization={Wolfram Research}, title={SetCookies}, year={2016}, url={https://reference.wolfram.com/language/ref/SetCookies.html}, note=[Accessed: 25-November-2024 ]}