Cookies API

cookie.remove()

Removes the cookie associated with the current document.

  • Accepts the cookie name as a string as the first argument.
    Accepts an optional second argument as an object with the following options:
    Option
    Type
    path
    string
    domain
    string
    secure
    boolean
    same
    'strict' or 'lax'
    To properly remove cookies, you must pass the same options as when setting cookies, except for "age", "expires", "prefixSecure", and "prefixHost".
Example:
cookie.remove('book');
// Removes the cookie 'book', '__Secure-book', and '__Host-book'.

cookie.remove('book', {
   path: '/',
   domain: 'book.com',
   secure: true,
   same: 'strict'
});
// Removes the cookie 'book' based on the provided options.