Baking Cookies

Cookies are little bits of information that you can leave on a user's hard drive, where they stay even after the user turns off the computer.

They represent the only way that javascript can store information to a users hard disc.

As such they allow information to be stored between sessions on the client side of the internet

In this way customer preferences and other marketing information can be stored.

Cookie limitations

Cookies do have a number of serious restrictions.

With those limitations in mind, let's learn about setting and reading cookies in javascript.

Two Important Notes

1. For the exercise you are going to undertake you must ensure that your browser can accept cookies.
In Internet Explorer use the menus Tools-Options-Advanced-Restore defaults

2. Closing a browser window where a cookie does not have an expiry date will delete the cookie.
As we will not be setting an expiry date in our exercises don't close the browser window during the exercise.