-
Notifications
You must be signed in to change notification settings - Fork 3
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
calling 'onBeforeRequest' callback from nodejs side #1
Comments
@disovi @kyungw00k don't you know what is accessible in |
@kuraga scope is limited exact to function inner context. Listener function is stringified before being sent to electron. |
@kuraga unfortunately yes. I've described a possible solution in linked issue, but you need some knowledge in electron-nightmare ipc connection to implement it. |
@kyungw00k @disovi can we change |
As far as I know, if you want to cancel the specific request, you can filter the request by filtering url on For example, If you want to cancel the specific request, const filter = {
urls: ['https://*.github.com/*', '*://electron.github.io']
}
nightmare.onBeforeRequest(filter, function (details, callback) { /* Electron-side scope */
/* POINT #1 */
callback({cancel: true})
}) I guess the point of this question is handing
Even if we change code The callback we provide in NodeJS-side is want to access |
@kyungw00k we want to have read access to a copy of NodeJS-side object. My task is different compared to @disovi 's: I want to set HTTP headers from file content. |
If your But it would be the different issue from this issue, right? |
@kyungw00k you are right. The idea was to use adblock extension together with nightmare. Unfortunately electron doesn't support chrome extensions. But there is an npm package Brave Adblock which implements this functionality. So basically I wanted to combine this engine with nightmare in onBeforeRequest callback. |
@kyungw00k , right 😄 @disovi , sorry! I'll create an issue. |
I've been looking the part which of the code had implemented Could you do that for me? |
@kyungw00k in their github-page sample: |
I want to make some processing of 'details' on nodejs side and then decide whether I want to cancel that request or not. It is only possible to access details through 'onBeforeRequest' event now. But there is no access to 'callback' inside that event. Is it possible to add such functionality? If yes, can you give me a hint how to achieve this? thanks.
The text was updated successfully, but these errors were encountered: