the cookie name
Optional
path: stringthe path to delete the cookie from (default: window.location.pathname
)
import { nukeCookie } from "@trashpanda001/helpers/cookie"
nukeCookie("orbit") // on `https://example.com/xy`
// Set-Cookie: orbit=; Domain=example.com; Secure; Max-Age=0
// Set-Cookie: orbit=; Domain=example.com; Path=/; Secure; Max-Age=0
// Set-Cookie: orbit=; Domain=example.com; Path=/x; Secure; Max-Age=0
// Set-Cookie: orbit=; Domain=example.com; Path=/xy; Secure; Max-Age=0
// Set-Cookie: orbit=; Domain=com; Secure; Max-Age=0
// Set-Cookie: orbit=; Domain=com; Path=/; Secure; Max-Age=0
// Set-Cookie: orbit=; Domain=com; Path=/x; Secure; Max-Age=0
// Set-Cookie: orbit=; Domain=com; Path=/xy; Secure; Max-Age=0
// Set-Cookie: orbit=; Secure; Max-Age=0
// Set-Cookie: orbit=; Path=/; Secure; Max-Age=0
// Set-Cookie: orbit=; Path=/x; Secure; Max-Age=0
// Set-Cookie: orbit=; Path=/xy; Secure; Max-Age=0
It's the only way to be sure.
Delete a cookie with all permutations of domains and subdomains of
window.location.hostname
and all subpaths of the given path.