bhylu.com

Advertisements

JS Cookies

Cookies are small values sent with matching HTTP requests. Sensitive session cookies should normally be set by the server with appropriate flags.

Where to run this

Use a local browser project for this example. It needs browser permissions, additional files, a server endpoint, or a library as described below. The restricted playground cannot provide those dependencies.

A practical example

JavaScript

document.cookie = "view=list; Path=/; SameSite=Lax; Secure";
console.log(document.cookie);

What happens

On a secure local test origin, a non-HttpOnly cookie can be read from the document.