Web Design: Use Cookies to Personalize Web Pages - dummies

Web Design: Use Cookies to Personalize Web Pages

By Lisa Lopuck

You’ve probably visited a website that knows who you are and immediately greets you by name, even without you having to log in. The magic sauce that makes this sort of personalization possible consists of little bits of code called cookies.

In the web-design world, cookies are little pieces of data that a web page leaves behind on your computer — sort of like a trail of data crumbs. As you use the site (for example, to order a product), the cookie stores information about your computer, your preferences, your name, and so on. Cookies can be one of two types:

  • Session: This cookie is only a temporary resident on your computer and stores information as you move from page to page. As soon as you quit the browser, the cookie is deleted, and none of your preferences are recorded for the next time you visit.

  • Permanent: This cookie is installed on your computer and keeps a running tab of data, storing your name, preferences, and other information so that they appear automatically on the website the next time you come back — even if you’ve shut down and restarted your machine.

Users can turn off the cookie feature in their browsers, so if you plan to use cookies, make sure that your web pages can also work without them. The user’s experience shouldn’t rely on cookies, just be enhanced by them.

Cookies can also pose a security risk for users. Because they store personal information such as the user’s name or website login information, cookies can be a target for other websites trying to get a user’s personal information. Only the website that left the cookie on the computer is supposed to be able to retrieve data from it — but some folks have suspected that it’s possible for other sites to hack into them.