What are secured cookies in JavaScript?

A secured cookie is a cookie that works with HTTP/HTTPS, known as a httpOnly cookie. These cookies are only used for HTTP requests, so unethical access though scripting is not possible. Therefore, cross-site scripting can be stopped, which in turn stops attacks.

The secure attribute is always activated for secured cookies, so it is transmitted with encrypted connections, without any hassles and security issues. The httpOnly flag does not give cookie access to JavaScript or any non-HTTP methods. This is situated in the secure cookie header.

The secure attribute and httpOnly flag ensure that the browser does not allow malicious scripts to access to the secure cookie data.