// All cookies for a URL
const cookies = webview.getCookies('https://example.com');
// Every cookie the webview has
const all = webview.getCookies();
for (const c of cookies) {
console.log(c.name, '=', c.value, ' domain:', c.domain);
}
WebviewCookie fields:
| Field | Type | Description |
|---|---|---|
name |
string |
Cookie name |
value |
string |
Cookie value |
domain |
string? |
Owning domain |
path |
string? |
URL path scope |
httpOnly |
boolean? |
Not accessible from JS |
secure |
boolean? |
HTTPS-only |
sameSite |
'strict' \| 'lax' \| 'none'? |
Cross-site policy |
webview.setCookie({
name: 'session',
value: 'abc123',
domain: 'example.com',
path: '/',
httpOnly: true,
secure: true,
sameSite: 'strict',
});
// Specific domain + path
webview.deleteCookie('session', 'example.com', '/');
// Name only (removes across all domains/paths)
webview.deleteCookie('session');
Wipes cookies, cache, local storage, IndexedDB, and session data:
webview.clearAllBrowsingData();
Pass incognito: true when creating the webview to start a session with no persistent storage at all — cookies, cache, and local storage are discarded on exit:
const webview = win.createWebview({
url: 'https://example.com',
incognito: true,
});