removeCookie()

Removes the specified cookie(s).

This function is valid in v2.3.0 to v2.14.0. This function has been downloaded 42 times.

Parameters

{string|RegExp|undefined|null=} name Optional, Default:undefined
Either the name of the cookie to remove or a regular expression matching the names of all of the cookies to remove. If undefined or null is supplied that means all cookies should be removed.
{Object=} opt_options Optional, Default:{"path":"/"}
Object whose property values can be used to specify additional options. If you want to specify the hosts for which the cookie will be removed you can set the domain property. If a domain is specified, subdomains are always included. If you want to specify the URL path from under which the cookie will be removed you can specify it in the path property. If you want to remove a secure cookie while on a secure site (https:) you can set the secure property to true.

Returns

{*}
If name is a string and matches the name of a cookie, that cookie's value will be returned as a string. If name is a string but doesn't match the name of a cookie undefined will be returned. If name is of type RegExp an object containing all of the cookies with names that match the specified regular expression will be returned. If name is undefined or null an object containing all of the cookies will be returned. If an object is returned each key will represent the name of each removed cookie and each value will be the value of that removed cookie.

Required Functions

This function requires the following functions which are included automatically:

  • has()
    Every object descended from Object inherits the hasOwnProperty method. This method can be used to determine whether an object has the specified property as a direct property of that object; unlike the in operator, this method does not check down the object's prototype chain.
  • setCookie()
    Takes the name of a cookie and sets its value.
  • getCookie()
    Retrieves one or more cookies.