Topic 5 · The internet and its uses

Cookies: session and persistent

Video lesson: Cookies: session and persistent▶ Watch the video lessonShort, exam-focused explanation of this topic on the CS with Aamir YouTube channel.

A cookie is a small text file that a web server sends to your web browser, which stores it on your device. The next time you visit the website, the browser sends the cookie back, so the website can recognise you and remember information about you.

The two types of cookie

Session cookiePersistent cookie
Where storedTemporarily, in the browser's memory (RAM)On the device's storage (e.g. hard disk or SSD)
How long it lastsDeleted when the browser is closedKept until its expiry date or until the user deletes it
Typical useKeeping items in an online shopping basket during one visitRemembering login details and preferences between visits

What are cookies used for?

Advantages and disadvantages

Benefits for the user: faster, more personalised browsing; no need to log in or re-enter details every time; shopping baskets are not lost while you browse.

Concerns: persistent cookies can be used to track a user's browsing, which some people see as an invasion of privacy. Users can delete cookies or block them in their browser settings, although some websites will not work properly without them.

Exam tips

You can see a real example on this website: our Privacy Policy explains the cookies used here.

Want the full topic notes, slides and worksheets? See Notes & Slides, practise with the free CS with Aamir Quiz App, or order the O Level Computer Science Study Guide.