How to work with webRequest api


#1

Hi all,

Can somone help me and explain what I am doing wrong in this code?

mainWindow = new BrowserWindow({width: 1280, height: 745});

mainWindow.loadURL("https://example.com");

var ses = mainWindow.webContents.session;

ses.webRequest.onBeforeRequest({urls: ["*/public/*"]}, function (details, callback) {
    console.log(details);
    callback();
};

It return exception: Cannot read property onBeforeRequest of undefined

Electron version is 0.36.0


#2

I am miss that this functionality was not included in this build. So I build electron by myself and now it works as a charm.