Wolfram Language & System 11.0 (2016)|Legacy Documentation

This is documentation for an earlier version of the Wolfram Language.View current documentation (Version 11.2)

SetCookies

SetCookies[assoc]
sets a cookie with attributes specified by the association assoc.

SetCookies[{assoc1,assoc2,}]
sets a list of cookies.

DetailsDetails

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

ExamplesExamplesopen allclose all

Basic Examples  (1)Basic Examples  (1)

View currently set cookies:

In[3]:=
Click for copyable input
Out[3]=

Set cookies for a domain:

In[4]:=
Click for copyable input
Out[4]=

The cookies are stored in $Cookies for later use:

In[5]:=
Click for copyable input
Out[5]=
Introduced in 2016
(11.0)