How to use cookie with electron & angularjs

时间:2016-07-11 23:04:14

标签: angularjs session cookies electron

I use electron with angularjs (electangular : access to all electron method in angularjs) and i want to set a cookie. I make this in my controller :

    var BrowserWindow = electron.BrowserWindow;
    var app = electron.app;

    var session = electron.session;
    var ses = session.fromPartition('persist:name');

    BrowserWindow.getAllWindows()[0].webContents.session.cookies.set({
            url: 'exemple.fr',
            value: 'guid',
            expirationDate: 1568277822
        }, function(error) {
            console.log(error);
        });

And i've got this error when i set the cookie : Error: failed at Error (native)

Thanks for you advice

1 个答案:

答案 0 :(得分:0)

尝试插入' http://'在你的网址中

http://.exemple.fr 

即使您的Cookie域遵循' .exemple.fr'

的通配符格式