Get a cookie value by name from document.cookie.
Code
Utilitiesdocument.cookie.split('; ').find(row => row.startsWith(`${name}=`))?.split('=')[1] || null;Parameters
Cookie name.
Browser·fetch() may be limited by CORS
More JavaScript Snippets
Clear LocalStorage
Clear all items from localStorage in the browser.
Copy to Clipboard
Copy text to the clipboard using the Clipboard API.
Delete Cookie
Delete a browser cookie by setting its expiration date to the past.
Detect Dark Mode
Check if user prefers dark mode using the prefers-color-scheme media query.
Detect Mobile Device
Check if user is on a mobile device by examining the user agent string.
Get LocalStorage
Retrieve a value from localStorage by key.