I am creating cookies using the code given below:
///Cookie
let cookie = {
url: 'http://www.example.com',
name: 'oauthDetailsGoogle',
value: JSON.stringify(oauthDetailsGoogle),
expirationDate: oauthDetailsGoogle.accessTokenExpireDateTime
};
///save cookie
electronConstants().mySession.cookies.set(cookie, (error) => {
///if error then return error
if (error) {
defer.reject(error);
}
///return null if no error
else {
defer.resolve(true);
}
});
In order to delete cookies I am using the following code:
electronConstants().mySession.cookies.remove('http://www.example.com', 'oauthDetailsGoogle', function (data) {
console.log(data);
});
Suppose I have created 10 cookes so in order to delete 10 cookes I will have to call the remove function 10 time with the specific details?
Please guide.. Many thanks
Finally, I found a solution in Electron Documentation : Source
here is the function that clear everything in one go:
electronConstants().mySession.clearStorageData([], function (data) {
console.log(data);
})
The first parameter takes options
so you can customize what you want to clear. Refer the documentation link that I provided above.
Many thanks.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With