JavaScript Cookie Store API
Sources:
title: Contents
style: nestedList # TOC style (nestedList|inlineFirstLevel)
minLevel: 1 # Include headings from the specified level
maxLevel: 4 # Include headings up to the specified level
includeLinks: true # Make headings clickable
debugInConsole: false # Print debug info in Obsidian console
Overview
Code Snippet Metadata:
- Date:: 2024-04-12
- Source: **
- Language: JavaScript
- Description:: ""
Code Snippet
WARNING
This feature is available only inĀ secure contextsĀ (HTTPS), in some or all supporting browsers.
cookieStore.getAll().then(console.log)
The API also has functions to manage cookies:
[cookieStore.delete](https://developer.mozilla.org/en-US/docs/Web/API/CookieStore/delete)
: to delete a cookie,[cookieStore.get](https://developer.mozilla.org/en-US/docs/Web/API/CookieStore/get)
: to get info on a single cookie,[cookieStore.set](https://developer.mozilla.org/en-US/docs/Web/API/CookieStore/set)
: to set a single cookieās info.
Details
In the past, developers usedĀ document.cookie
Ā to get cookie information. But it has its limits, like not showing the domain, path, or expiration details.
However, developers could use dev tools for more details. Now, theĀ Cookie Store APIĀ gives access to those detailed cookie attributes, just like dev tools. But it canāt reach cookies with the HttpOnly
attribute.
See Also
- JavaScript Map of Content
- JavaScript Code
- Hyper Text Markup Language (HTML)
- Cascading Style Sheets (CSS)
- React.js
- Next.js
Appendix
Note created on 2024-04-12 and last modified on 2024-04-12.
Backlinks
LIST FROM [[JS - Cookie Store API]] AND -"CHANGELOG" AND -"04-RESOURCES/Code/JavaScript/JS - Cookie Store API"
(c) No Clocks, LLC | 2024