MMDT1022 HTML II and Javascript
Week 8
Week 8 This week the topic is about creating, reading, and writing cookies. Cookies are used in most e-commerce web sites to track visitor data, such as visitor preferences, shopping cart contents, etc Testing cookies site1 Motorhead site. When testing, you must test with a web server. Whether that means a real webserver, or the simplified web server plugin for Visual Studio Code (Live Server). Important: when using VS Code, make sure the live preview of the page is actually working, and you see 127.0.0.1:xxxx (which means local host) in the address bar. If you see file:///, the setting and reading of cookies will not work. Screenshots below a correct live preview.
When testing, you must test with a web server. Whether that means a real webserver, or the simplified web server plugin for Visual Studio Code (Live Server). Important: when using VS Code, make sure the live preview of the page is actually working, and you see 127.0.0.1:xxxx (which means local host) in the address bar. If you see file:///, the setting and reading of cookies will not work. Screenshots below a correct live preview.
|

Lab Cookie For this exercise you need to create three web pages. Page 1 - Write a JavaScript program on a web page that collects at least three pieces of data about a user and creates and writes a cookie. This data could be such things as birthday, address, favorite color, etc. Set the cookie to have an expiration period of 60 seconds. Page 2 - A basic page with not much on it, but to simply go on to page 3. Page 3 - Write a JavaScript program on a web page that reads the cookie back and displays the information contained in the cookie. Note: You cannot use the same 3 things that we did in class. Pick new items to read/write a cookie. Important! Variable names in your code should not be the same as the ones we did in class. Create variable names that represent your topic! Not following this requirement will result in a decrease in points.
Assignment is due one instructional week from when it was assigned. 50% penalty if late. |