80 likes | 253 Views
Web Page Technologies. I n This Lecture You Will Learn About …. What cookies are Why cookies are used How to create cookies How to retrieve and use cookies How to delete cookies. Cookies. When I log on to Amazon it looks like this. Cookies.
E N D
In This Lecture You Will Learn About … • What cookies are • Why cookies are used • How to create cookies • How to retrieve and use cookies • How to delete cookies
Cookies • When I log on to Amazon it looks like this
Cookies • Cookies are little pieces of information stored on your hard disk • They are objects inside the document • A cookie must have a name and a value document.cookie = “usersFirstName=John”;
Cookies • There are several optional attributes document.cookie = “usersFirstName=John; expires = 25-Dec-03 00:00:01 GMT; domain = amazon.co.uk”;
Cookies • Using cookies is easy – somebody else has done all the hard work • Public domain “cookie code “ exists SetCookie(name, value, expires, path, domain, secure) GetCookie(name) DeleteCookie(name, path, domain)
Cookies • All we have to do is write some JavaScript to use the “cookie code”
Lecture Slides • www.dcs.napier.ac.uk/~owens/wpt/lectures/wptlecture6.ppt