Note 10 for Web Scripting
Watch & Read:
Cookies are text files that we deposit on and retrieve from the user's hard drive. (The cookie is a variable that is stored on our computer and a web script can retrieve the information contained within the cookie)
The Cookie object requires setting a name and a value
By default, the cookie will expire when the browser is closed. You must specify an expiration date if you want the cookie to last longer
Session: Each visit to a Web page by a userSyntax: document.cookie = "name = value; expires = expiration; ";
Cookie |
|
Syntax |
Example |
document.cookie = "name = value; "; (required) Additional Property Statements you can add to your Cookie. expires: The cookie will expire when the browser is closed unless specified otherwise. path: Files on the server that can use the cookie domain: by default only the domain that sets the cookie can use the cookie secure: Sets how the information should be transmitted (HTTPS vs HTTP) |
document.cookie = "mycookie = jon; |
Terms you need to Lookup:
Cookies, Session,
split() vs indexOf()
escape() vs unescape()
Server Side vs Client Side Cookies,
First Party vs Third Party Cookies,
Review the following:
Where does FireFox and IE store Cookies
W3schools Cookie Tutorials
Homework:
Create a Dynamic page (a page with drop down menus or content that you can change on the fly)
You should Read Chapters 8
Reminder: Post on the Discussion Board Section at least one URL of a Web Page that uses a Web script and describe how the script works.
Final Step:
Imagine that your mind is a DVD recorder / player and you can review this content anytime you want. I want you to close your eyes and quickly review in your mind everything we covered in class.
I also want you to review everything we covered before you go to bed because I want your mind to process this information while you sleep. You don’t need to spend much time on this review, 5 minutes will be enough!