$Cookies

$Cookies

is a global variable that contains a list of cookies to be used by functions such as URLExecute.

Details

  • $Cookies must be a list of associations, with each association representing a cookie.
  • The association for each cookie can contain the following elements:
  • "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" has value Automatic if the cookie is for the duration of the session only.
  • If not set, "Domain" is assumed to be Automatic, so that the domain is deduced from the specific URL from which the request was generated.
  • With the setting "AllSubdomains"->True, cookies are also sent to subdomains of the domain specified by "Domain".
  • If not set, "AllowSubdomains" is assumed to be Automatic, which corresponds to True if "Domain" is Automatic, and False otherwise.
  • If not set, "ConnectionType" is assumed to be All. "ConnectionType"->"HTTPS" specifies that the cookie should be sent only when an HTTPS connection is used.
  • If not set, "ScriptAccessible" is assumed to be True, indicating that web browsers should allow the cookie to be accessed using JavaScript, even if the JavaScript is on a page from another domain.
  • $Cookies can be modified using SetCookies and ClearCookies.
  • With the default setting CookieFunction->Automatic, functions like URLRead automatically append all newly received cookies to $Cookies.
  • Block[{$Cookies},] can be used to localize cookies. Block[{$Cookies,$CookieStore},] also blocks the saving of persistent cookies.

Examples

open allclose all

Basic Examples  (1)

View currently set cookies:

Cookies can be received and set when URL commands are executed:

Applications  (1)

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:

Properties & Relations  (3)

Cookies can be added using SetCookies:

Cookies can be queried using FindCookies:

Cookies can be removed using ClearCookies:

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

Text

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

CMS

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

APA

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

BibTeX

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

BibLaTeX

@online{reference.wolfram_2024_$cookies, organization={Wolfram Research}, title={$Cookies}, year={2016}, url={https://reference.wolfram.com/language/ref/$Cookies.html}, note=[Accessed: 21-November-2024 ]}