OnBeforeSendHeaders in a webview problem


#1

Hello,

I would like to know if it is possible to block a specific request in a webview.
I am using the onBeforeSendHeaders function to no avail, the headers are sent before i can block what’s needed.

webview.getWebContents().session.webRequest.onBeforeSendHeaders({
urls: [‘https://.googleusercontent.com/proxy/=s0-d-e1-ft*’]
}, (details, callback) => {
console.log(details.url, details.resourceType)
callback({cancel: true})
})

What is the most adapted event on the webview to initiate this before the headers are sent ?

Thank you!