Step 1: History & purpose

You cannot browse today's web without being asked about cookies. In fact, you probably saw a cookie dialogue when you first visited this website. But how did cookies come to exist and why?

Internet without cookies

xkcd comic
This, but on every website - from xkcd.com

When you open a website, your browser connects to a web server, transfers a document or other file onto your computer, and displays it for you. However, before 1994, website operators had no good way of keeping track of users across individual requests. When you reloaded a page or followed a link to another page on the same website, then from the website's point of view you were no different from a brand new user. This proved problematic in many ways. For example, developers were unable to build an online shopping website, because they could not keep track of what a user had already put into their shopping cart.

Remembering users

Web cookies were introduced to solve the problem of remembering users across requests.

What is a cookie?

Cookies are little pieces of text that websites can tell your browser to store. If you open the website again, your browser can provide this text to the website, allowing the website to remember who you are. Your browser could in principle choose to not store or return cookies, but then you could not use services like shopping websites.

Compare this system to supermarket loyalty cards or the numbers given out at self-service kiosks in fast-food restaurants. The card or number allows you to be identified and remembered in this particular context. You are responsible for keeping track of it and showing it again at the right time. But there is an incentive for you to do so, because it allows you to get the services you want.

Further reading

If you want to find out more about how and why cookies were introduced, you can read a blogpost by Lou Montulli, one of the pioneers in developing internet browsers.

Cookie Dialogue on ed.ac.uk
In the European Union, website are required to obtain informed consent before using cookies.

Lou Montulli on web cookies

Questions to think about

  • Can you think of alternative solutions to the problem of remembering users?
  • Why do you think these solutions were not adopted?
  • Try to think of other functionality on websites that relies on remembering users.
  • Is it ever bad for you if a website remembers who you are?

Going further

You will now learn about one way in which cookies can be stored in your browser, and we will investigate how cookies behave.

Setting, Editing & Deleting Cookies