Q
What does the HttpOnly cookie attribute do?
-
A
It encrypts the cookie
-
B
It prevents JavaScript (document.cookie) from reading the cookie, which reduces the impact of XSS
-
C
It makes the cookie expire on browser close
-
D
It sends the cookie only over HTTP and never HTTPS
Correct Answer:
B. It prevents JavaScript (document.cookie) from reading the cookie, which reduces the impact of XSS
Explanation:
The Secure attribute is what restricts a cookie to HTTPS connections.