deleteCookie

Delete cookies visible to the current page. By providing a cookie name it just removes the single cookie.

Usage

1
client.deleteCookie([name]).then(callback);

Parameters

Param Type Details
name
optional
String name of cookie to be deleted

Example

deleteSingleCookie.js
1
2
3
4
5
6
7
8
9
client
.setCookie({name: 'test', value: '123'})
.getCookie().then(function(cookies) {
console.log(cookies); // outputs: [{ name: 'test', value: '123' }]
})
.deleteCookie('test')
.getCookie().then(function(cookies) {
console.log(cookies); // outputs: []
});
deleteMultipleCookies.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
client
.setCookie({name: 'test', value: '123'})
.setCookie({name: 'test2', value: '456'})
.getCookie().then(function(cookies) {
console.log(cookies);
// outputs:
// [
// { name: 'test', value: '123' },
// { name: 'test2', value: '456' }
// ]
})
.deleteCookie()
.getCookie().then(function(cookies) {
console.log(cookies); // outputs: []
});

Uses