Explain what is meant by cookies and how they are used
Cookies: What They Are and How They’re Used 🍪
What Is a Cookie?
A cookie is a tiny text file that a website stores on your computer or mobile device. Think of it as a note left by the site to remember something about you. For example, when you log into a site, a cookie can remember that you’re logged in so you don’t have to type your password again.
Key Parts of a Cookie
| Attribute | What It Means |
|---|---|
| Name | The identifier for the cookie. |
| Value | The data stored (e.g., a session ID). |
| Domain | Which website can read the cookie. |
| Path | Which part of the site the cookie applies to. |
| Expires / Max-Age | When the cookie will be deleted. |
| Secure | Sent only over HTTPS. |
| HttpOnly | Not accessible via JavaScript. |
Common Uses of Cookies
- Session Management – Keeps you logged in while you browse.
- Personalisation – Remembers your language or theme preferences.
- Tracking & Analytics – Gathers data on how you use a site (e.g., pages visited).
- Targeted Advertising – Shows ads that match your interests.
Exam Tip: Remember the Difference Between Session and Persistent Cookies
• Session cookie – Lives only while the browser is open; deleted when you close it.
• Persistent cookie – Remains on your device until it expires or you delete it.
Use this distinction when answering questions about how a website remembers you after you leave.
Quick Quiz
- What attribute ensures a cookie is only sent over a secure connection?
- Why might a website use a persistent cookie instead of a session cookie?
Revision
Log in to practice.
0 views
0 suggestions