17 function calculation I

17 function calculation I - Document Cookies A cookie is a...

Info iconThis preview shows pages 1–4. Sign up to view the full content.

View Full Document Right Arrow Icon
Document Cookies A cookie is a small amount of named data stored by the web browser. A common usage of cookies is to recall user preferences across web browsing sessions. We can create, read, modify, and delete a cookie through the document.cookie property. A typical location of cookies stored in the computer:
Background image of page 1

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon
Document Session cookies and persistent cookies Session cookie: Automatically deleted when the user exits the browser. To create or modify a session cookie: document.cookie = "name =value " For example: document.cookie = " imagesPerPage =6 " Persistent cookie: Assigned an expiration date/time, after that the cookie will be deleted. Stored in the computer's hard disk. To create or modify a persistent cookie, we need to set the expiration date: document.cookie = " name=value; expires= UTCDate " For example: var  expireDate =ne w Da te (2010,11,31); do c um e nt.c o o kie  = "im ag e s Pe rPa g e =6 ;expires= "  +  expireDate.toUTCString() ;
Background image of page 2
Document Deleting Cookies § Session cookies are automatically deleted when the browser session ends.
Background image of page 3

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon
Image of page 4
This is the end of the preview. Sign up to access the rest of the document.

This note was uploaded on 03/10/2012 for the course CS 1301 taught by Professor Dr.wong during the Winter '08 term at City University of Hong Kong.

Page1 / 5

17 function calculation I - Document Cookies A cookie is a...

This preview shows document pages 1 - 4. Sign up to view the full document.

View Full Document Right Arrow Icon
Ask a homework question - tutors are online