Skip to content
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

ses.webRequest.onBeforeRequest: redirectUrl is ignored #4034

Closed
diracdeltas opened this issue Jan 8, 2016 · 3 comments
Closed

ses.webRequest.onBeforeRequest: redirectUrl is ignored #4034

diracdeltas opened this issue Jan 8, 2016 · 3 comments

Comments

@diracdeltas
Copy link
Contributor

The following code works as expected (all HTTP requests are canceled):

session.webRequest.onBeforeRequest({
  urls: ['http://*/*']
}, (details, cb) => {
  cb({cancel: true})
})

However, when redirectUrl is specified, requests are still sent instead of being canceled and redirected.

session.webRequest.onBeforeRequest({
  urls: ['http://*/*']
}, (details, cb) => {
  cb({redirectUrl: 'https://example.com'})
})

I am on electron-prebuilt 0.36.3

@deepak1556
Copy link
Member

there is a typo, should be redirectURL . Otherwise unable to reproduce.

session.webRequest.onBeforeRequest({
  urls: ['http://*/*']
}, (details, cb) => {
  cb({redirectURL: 'https://example.com'})
})

@diracdeltas
Copy link
Contributor Author

🤦

You're right, thanks for resolving.

@diracdeltas
Copy link
Contributor Author

FWIW, the source of my confusion was that the original WebRequest API (https://developer.chrome.com/extensions/webRequest) uses redirectUrl instead of redirectURL. This might trip up other developers trying to port Chrome extensions to Electron.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants