WebviewJS gives you programmatic access to the cookies and browser storage of any webview directly from Node.js. You can read cookies scoped to a URL or retrieve every cookie the webview holds, write new cookies with full attribute control, delete individual cookies or wipe all browsing data, and isolate storage between windows using incognito mode or separate WebContext profiles.
Reading cookies
Call webview.getCookies(url?) to retrieve cookies. Pass a URL string to get cookies that apply to that origin, or omit the argument to get every cookie the webview has stored.
WebviewCookie fields
getCookies() returns an array of WebviewCookie objects. The same interface is used for setCookie().
Writing a cookie
Call webview.setCookie(cookie) with a WebviewCookie object to set or update a cookie. All fields except name and value are optional.
Deleting cookies
Call webview.deleteCookie(name, domain?, path?) to remove a specific cookie. Provide domain and path for a precise match, or omit them to delete the named cookie across all domains and paths.
Clearing all browsing data
webview.clearAllBrowsingData() wipes everything the webview has stored: cookies, cache, local storage, IndexedDB, and session data.
clearAllBrowsingData() is destructive and cannot be undone. It erases all
cookies, cached resources, localStorage, IndexedDB databases, and session
data for the webview. Call it only when you intentionally want to reset all
browser state.
Incognito mode
Pass incognito: true when creating a webview to start an ephemeral session. No data is written to disk, and all cookies, cache, and local storage are discarded when the webview is closed.
Incognito mode applies to the individual webview. Other webviews in the same application retain their normal persistent storage.
Isolated profiles with WebContext
For scenarios where you want multiple windows with completely separate browser data — different logged-in users, isolated cache directories, or distinct session cookies — create a WebContext for each profile and pass it when creating the webview.
Cookies, cache, and storage stored through webview are isolated to ./profiles/user1 and do not bleed into other webviews or profiles. See the WebContext API reference for additional options.
Related pages