TOC PREV NEXT INDEX

Put your logo here!


cookie


Gets/sets a list of the cookies associated with the current document.

Syntax

cookie_list = document.cookie 
document.cookie = cookie_list 

Parameters

cookie_list is a string containing a semicolon-separated list of cookies

Example

// this function sets two cookies and then 
// displays them in an alert 
function sgCookie() { 
  document.cookie = "name=oeschger"; 
  document.cookie = "favorite_food=tripe"; 
  alert(document.cookie); 
} 
// returns: name=oeschger;favorite_food=tripe 

Notes

If there are no cookies associated with a document, this function returns an empty string. Note also that you cannot use this property to set more than one cookie at a time.

Specification

html


mozilla.org | mailto:oeschger | bug 93108
TOC PREV NEXT INDEX