Posto qui le regole che definiscono un cookie. Oltre alla coppia
codice:
document.cookie = escape("chiave") + "=" + escape("valore");
è possibile aggiungere quanto segue:
  • ;path=path (e.g., '/', '/mydir') If not specified, defaults to the current path of the current document location.
  • ;domain=domain (e.g., 'example.com', '.example.com' (includes all subdomains), 'subdomain.example.com') If not specified, defaults to the host portion of the current document location.
  • ;max-age=max-age-in-seconds (e.g., 60*60*24*365 for a year)
  • ;expires=date-in-GMTString-format If not specified it will expire at the end of session. See Date.toUTCString() for help formatting this value.
  • ;secure (cookie to only be transmitted over secure protocol as https)