Skip to main content
Using Deno in production at your company? Earn free Deno merch.
Give us feedback


The Deno Standard Library
Go to Latest
function deleteCookie
import { deleteCookie } from "";

Set the cookie header with empty value in the headers to delete it

Note: Deleting a Cookie will set its expiration date before now. Forcing the browser to delete it.


Example 1

import { deleteCookie } from "";

const headers = new Headers();
deleteCookie(headers, "deno");

const cookieHeader = headers.get("set-cookie");
console.log(cookieHeader); // deno=; Expires=Thus, 01 Jan 1970 00:00:00 GMT


headers: Headers

The headers instance to delete the cookie from

name: string

Name of cookie

attributes: { path?: string; domain?: string; }

Additional cookie attributes