What happens to a session cookie (one without Max-Age or Expires) when the browser is closed?
- A.The browser deletes session cookies when the browser session ends (all windows closed), making them ephemeral
- B.The cookie persists until the server explicitly deletes it with Max-Age=0
- C.Session cookies expire after 24 hours regardless of browser state
- D.Session cookies are stored permanently in the browser's history
Why A is correct
Session cookies - those without Expires or Max-Age - are stored only in memory and deleted when the browser session ends (all windows/tabs of the browser are closed). This is a convenient security feature for shared computers. Note: modern browsers with session restore can persist session cookies across restarts if the user has 'restore previous session' enabled.
Know someone studying for Web App Fundamentals? Send them this one.