How to manipulate cookies in BrowserWindow?


Hi all!

I’m looking for something like node-webkit’s window.cookies ->

I couldn’t find anything relevant on or anywhere in the source code.

Any tips? Is this not implemented or am I missing something?


Same here.

I can see them:

    window.webContents.on('did-finish-load', function() {

But I cant get them, this function passes back ‘null’ if I try ‘return document.cookie’


The main issue with executeJavascript or injecting a script before the page loads is that you can’t delete HttpOnly cookies or manipulate cookies across domains like you can with the node-webkit cookies api.


I’m trying to read the cookies after the page loads on the ‘did-finish-load’ event, executeJavascript can access them using document.cookie but not pass them back.

    var BrowserWindow = require('browser-window');
    var window = new BrowserWindow({
        "width": 900, 
        "height": 450, 
        "show": false, 
        "resizable": false, 
        "skip-taskbar": true
    window.on('closed', function() {
      window = null;
    window.webContents.on('did-finish-load', function() {
        var document.cookie
       // how to get cookies ????

Bit frustrating!


Electron v0.28.3 introduces a cookies API. Check out the browser-window documentation and look for WebContents.session.cookies.


Does this process get called in the rendering process or main? Thanks for the help!