🎙 Free live masterclass · Sun, 29 Nov, 7:00 pm IST · Java Full Stack roadmap Register free →
Skills101
← Quiz: Browser Storage and Cookies: all 10 questions

Quiz: Browser Storage and Cookies · Question 5 of 10

What does the HttpOnly cookie attribute do?

What does the HttpOnly cookie attribute do?

  1. A.Sends the cookie only over HTTP, not HTTPS
  2. B.Stops JavaScript from reading the cookie, so an injected script cannot steal it
  3. C.Deletes the cookie when the tab closes
  4. D.Makes the cookie larger
Answer & explanation

Correct answer: Stops JavaScript from reading the cookie, so an injected script cannot steal it

HttpOnly cookies are still sent to the server but are hidden from document.cookie.

Can you get the rest right without peeking?

Take the timed Quiz: Browser Storage and Cookies quiz free. Pass it to earn XP and count towards your certificate.

Start the quiz →