The shape of the lesson
By the end of the lesson, learners can
- What a cookie is: HTTP on its own does not remember anything between one request and the next.
- Session or persistent?: The difference is how long the cookie lasts, which decides what it can be used for.
- What cookies are used for: The syllabus names four uses.
- Cookie: small text file sent by a website, stored by the browser on the user's device.
- Session: temporary memory; deleted when the browser is closed.
- Persistent: hard drive; kept until it expires or is deleted.
- Uses: personal details, preferences, shopping cart, login details.
One picture every idea returns to
A cookie is a small text file sent by a web server and stored by the browser on the user's computer. It holds data about the user's visit; the browser sends it back to the site on later requests, so the site can recognise the user. A session cookie is stored in temporary memory and is deleted when the browser is closed. A persistent cookie is saved on the hard drive and remains until its expiry date or until the user deletes it.
Forty-five minutes, phase by phase
| Time | Phase | What happens in the room | Grouping |
|---|---|---|---|
| 0 to 5 min | Hook: predict | Open with the question in the title, Websites that remember.. Add a jacket to your basket, click to another page, and the jacket is still there. Put the figure on the board: it is the one picture every idea in the lesson returns to. | Whole class, then pairs |
| 5 to 13 min | Teach and check: What a cookie is | HTTP on its own does not remember anything between one request and the next. Project tab 2 of the lab (Session and persistent cookies) and let a student drive it while the class predicts. | Whole class, then pairs |
| 13 to 21 min | Teach and check: Session or persistent? | The difference is how long the cookie lasts, which decides what it can be used for. | Pairs |
| 21 to 30 min | Teach and check: What cookies are used for | The syllabus names four uses. Model the worked example Pick the type on the board, one line at a time. Your turn: A news site shows every visitor's chosen language each time they return. Which type of cookie is used, and why? | Frayer Model |
| 30 to 36 min | Check | The four Stage 1 questions from the student lesson, answered on mini whiteboards or by show of fingers. Re-teach the one most get wrong. | Individual, then whole class |
| 36 to 43 min | Plenary | The exam-style questions from Stage 2, one at a time: thirty seconds alone, then a random call. The feedback lines in the key give the examiner's wording. | Individual, random call |
| 43 to 45 min | Exit and homework | Set the worksheet below (6 questions, 13 marks). Learners self-assess against the objectives before they leave. | Individual |
Protect the parts that carry the learning
The sequence carries about fifty minutes of material, so the lab is driven by one student while the class predicts rather than explored freely. Times are a guide.
Protected: the check at 30 minutes. It is the only individual read on whether the key idea landed, and it is not cut.
Cut first if the build overruns: the last check in What cookies are used for, never the check or the plenary.
In a 60 minute block: run worksheet questions 1 to 3 in class as a Rally Coach set and model both the hardest worked example and its check live.
Frayer Model
Pairs fill a four-box grid for the key term: definition, characteristics, examples and non-examples. The non-examples box is where the misconceptions surface, so give it the most time.
The full structure, with its variations and the other twelve, is on the cooperative-learning page.
What to head off, and how
| Trap learners fall into | Teaching move that pre-empts it |
|---|---|
| A session cookie is not deleted when the user leaves the page or the website. | It is deleted when the browser is closed. |
Session and persistent cookies: worksheet
6 questions, 13 marks. Written in the style of the papers; no past paper question is reproduced.
State what is meant by a cookie.
Explain the difference between a session cookie and a persistent cookie.
Identify three ways that cookies are used by websites.
An online shop wants customers to stay logged in for 30 days, even after they turn off their computer. Identify the type of cookie needed and explain your choice.
Explain how a cookie allows a website to keep items in a shopping cart as the user moves between pages.
A student says that cookies are dangerous because they can run on your computer and delete files. Evaluate this statement.
Answer key and marking notes
- A small text file sent by a web server / website.
- Stored by the web browser on the user's computer (holding data about the user's visit / preferences).
- A session cookie is stored in temporary memory and is deleted when the browser is closed.
- A persistent cookie is stored on the hard drive and remains until its expiry date or until the user deletes it.
- Saving personal details.
- Tracking user preferences.
- Holding items in an online shopping cart / storing login details (any one).
- A persistent cookie.
- Because it is stored on the hard drive with an expiry date (30 days), so it is not deleted when the browser is closed or the computer turned off.
- The website stores the cart contents / an ID for the cart in a cookie on the user's device.
- The browser sends the cookie with each new page request, so the server can recognise the user and show the same cart.
- Incorrect: cookies are small text files (data), not programs, so they cannot run or delete files.
- However, persistent cookies can track users' browsing / preferences, which raises privacy concerns.
6 multiple-choice questions on this lesson
From the topic question bank. Assign them in the app for a marked score in your gradebook, or run the topic as a class game.
What is a cookie?
- AA small text file sent by a web server and stored by the browser on the user's device
- BA small program that runs on the user's computer when a page opens
- CA record on the DNS of every website a user has visited
- DA type of malware that copies a user's keystrokes
When is a session cookie deleted?
- AWhen the browser is closed
- BWhen the user moves to a different page
- COn its expiry date, which may be months away
- DOnly when the user deletes it by hand
Each time a user returns to a weather website it shows temperatures in degrees Celsius, which the user chose on a previous visit. Which type of cookie is being used?
- AA persistent cookie tracking the user's preferences
- BA session cookie holding the user's shopping cart
- CA session cookie that is deleted when the page closes
- DNo cookie: the web server remembers the user's IP address
A user adds three books to a basket on an online shop, then moves between several pages before paying. The site does not need to remember the basket after this visit. Which cookie is most suitable?
- AA session cookie
- BA persistent cookie with a one-year expiry date
- CA cookie stored on the DNS
- DA cookie stored in the router
A music website wants users who tick "Remember me" to stay logged in for 30 days, even after switching their computer off. Which statement explains the right choice?
- AA persistent cookie, because it is stored on the hard drive with an expiry date 30 days ahead
- BA session cookie, because it is kept until the user next logs out
- CA persistent cookie, because it is stored in RAM, which keeps data when the power is off
- DA session cookie, because it is deleted after exactly 30 days
A student says: "Cookies are dangerous because they can run on your computer and delete your files." Which is the best evaluation?
- AWrong, because cookies are text files that cannot run; but persistent cookies can track browsing, which raises privacy concerns
- BCorrect, because every cookie is a program that the browser runs when a page opens
- CWrong, because cookies are deleted the moment they reach the computer
- DCorrect, because session cookies are a type of virus that attaches itself to files
Quiz key
A cookie is a small text file created by the website and kept by the browser, then sent back with later requests so the site recognises the user. It is not a program, so it cannot run. The DNS stores domain names and IP addresses, not users' visits, and recording keystrokes is what spyware does.
Session cookies are held in temporary memory and are deleted when the browser is closed. They survive moving between pages, which is why a basket is kept while shopping. An expiry date months away, or lasting until the user deletes it, describes a persistent cookie.
The preference has to be remembered from one visit to the next, so it is stored in a persistent cookie on the hard drive until it expires. Session cookies are deleted when the browser closes, so they could not remember it, and there is no shopping cart here. Relying on the IP address is unreliable because many users share or change IP addresses; cookies are how sites recognise returning users.
A session cookie keeps the basket while the user moves between pages and is deleted when the browser closes, which is all that is needed here. A persistent cookie would keep the data long after it was needed. Cookies are stored by the browser on the user's device, not on a DNS or router.
A persistent cookie is saved in secondary storage (the hard drive), so it survives the computer being turned off, and its expiry date can be set to 30 days. A session cookie is deleted when the browser closes, whatever the user does. RAM is volatile, so it loses data when the power is off, and session cookies have no 30-day expiry.
Cookies are small text files holding data, so they cannot execute or delete files. The real concern is privacy: persistent cookies can track what a user looks at across visits. Cookies are not programs or viruses, and they are kept (until the browser closes or they expire), not deleted on arrival.
What to project
The student lesson embeds these tabs. Open them full screen on the projector; every slider has a drag handle on the stage.
Slides for this lesson
A projectable deck for every pack is on the way. Until then, present the student lesson full screen: its sections, figure and lab tabs follow the same order as the plan above.