GoalExplain what a cookie is, what it holds and how a website uses it, without mixing it up with a virus.
New words
cookie · a small text file that a website asks your browser to storebrowser · the program you use to look at web pagessession · one visit to a website, from the time you arrive until you leaverecognise · to know again
Explanation
A cookie is a small text file. A website asks your browser to store it. The cookie holds a short code or a few settings, such as your language or the items in your basket. When you visit the site again, the browser sends the cookie back, and the site recognises the same browser. This is why a shop can remember a basket for an hour, or a page can stay in your language. A cookie does not hold your name or secrets unless you typed them into the site. It is not a virus, and it cannot read your computer. Cookies are useful for settings and baskets, but some cookies can follow what a browser does over time, so websites ask people for their consent, and browsers let adults see and delete cookies.
Browser asks for a page→Site sends the page and a cookie→Browser stores the cookienext visit→Next visit: browser sends it back
Worked examples
Cookie name
What it holds
What it is used for
language
en
show the pages in English
basket
3 items
remember what was picked
visitor
code 48213
recognise the same browser
An invented garden shop stores three cookies in a visitor’s browser. Each holds only a short piece of text.
Can a cookie hold this?
Answer
a short code
yes
a language setting
yes
a person’s name
only if the person typed it into the site
a virus
no
A cookie does not know a person’s name unless the person gave it. This table compares what a cookie holds with what it does not.
Pupil
My basket is still here!
Helper
The site recognised your browser from its cookie.
Pretend a pupil’s browser keeps a basket cookie. She closes the page, and when she comes back an hour later, the basket still shows 3 items.
Class activity
Cookie play (on paper, no computer). Cut three small cards and write a cookie on each, for example ‘language = fr’, ‘basket = 2 items’ and ‘visitor code = 77201’. One person plays the browser and keeps the cards. Another plays the website: the website hands over a card at the first visit, and gives a different page the next time when the browser shows the card. Swap roles. Finally write a sentence that says what a cookie is and one thing it is not. If you have a computer or tablet, with a trusted adult, you may look up how to see cookies in a browser.
Practice
1
Which of these could be stored in a cookie: a language setting, a virus, a short visitor code, a secret password you never typed?
Item
Could be stored in a cookie?
Language setting
?
A virus
?
Short visitor code
?
A secret password never typed
?
A language setting and a short visitor code. A virus is not a cookie. A password the person never typed cannot be in a cookie, because a cookie holds only what the site gave it or what you told the site.
2
Why does a basket stay full when you leave an online shop and come back later?
Add to basket→Cookie stored→Return later→Browser sends cookie→?
The site stored a cookie in the browser with a code. When the browser sends it back, the site finds the basket again.
3
A friend says: ‘Cookies are computer viruses that read all your files.’ Correct this in two sentences.
A cookie is a small text file that a website asks the browser to store. It holds a short code or settings. It is not a virus and it cannot read your files.
4
Explain what ‘the site recognises the browser’ means.
The browser sends back the cookie the site gave it earlier, so the site can tell it is the same browser as before. It does not know the person’s name unless the person gave it.