TL;DR: execute in console to set cookie name
NAME
and valueVALUE
:document.cookie = 'NAME=VALUE; path=/';
Did you know you can set a document cookie without a browser extension?
This is done by executing JavaScript code in the browser console.
Console
Open the browser console:
- Right-click the webpage
- Select
Inspect
/Inspect Element
- Go to the
Console
panel
Code
Given a cookie with name NAME
and value VALUE
, the JavaScript code will look like:
document.cookie = 'NAME=VALUE; path=/';
path=/
ensures the cookie is not limited to the current path of the document location. See options.
Paste the JavaScript code in the browser Console
and hit Enter to execute it.
To see all cookies, run the following JavaScript code in the browser Console
:
console.log(document.cookie);