0

Can we delete HttpOnly and Secured Cookies using javascript ,jsp or java or html?

Is it possible to write some code and clear out all the cookies from browser? Does not matter if it is a secured or an HttpOnly, I want to delete it anyway. Is this possible?

Aman Singh
  • 91
  • 3
  • 8

1 Answers1

0

No, it is not possible. A cookie with the HttpOnly attribute is inaccessible to JavaScript. HttpOnly cookie helps to mitigate cross-site scripting (XSS) attacks. Refer: MDN docs

How to read a HttpOnly cookie using JavaScript

To clear all the cookies (without httpOnly attribute) from the browser refer: Clearing all cookies with JavaScript

Jishnu
  • 441
  • 3
  • 13