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

[Bug]: SetWindowOpenHandler cannot be used for <webview /> #37218

Closed
3 tasks done
iwangx opened this issue Feb 10, 2023 · 2 comments
Closed
3 tasks done

[Bug]: SetWindowOpenHandler cannot be used for <webview /> #37218

iwangx opened this issue Feb 10, 2023 · 2 comments
Labels

Comments

@iwangx
Copy link

iwangx commented Feb 10, 2023

Preflight Checklist

Electron Version

22.0.3

What operating system are you using?

Windows

Operating System Version

Windows 10

What arch are you using?

x64

Last Known Working Electron version

22.0.3

Expected Behavior

can use setWindowOpenHandler normally

Actual Behavior

document.querySelector('webview').setWindowOpenHandler(({ url }) => {
  if (url === 'about:blank') {
    return {
      action: 'allow',
      overrideBrowserWindowOptions: {
        frame: false,
        fullscreenable: false,
        backgroundColor: 'black',
        webPreferences: {
          preload: 'my-child-window-preload-script.js'
        }
      }
    }
  }
  return { action: 'deny' }
})

setWindowOpenHandler document.querySelector('webview').setWindowOpenHandler is not a function

Testcase Gist URL

No response

Additional Information

No response

@miniak
Copy link
Contributor

miniak commented Feb 10, 2023

It was never supposed to. You need to handle this in the main process.

@miniak miniak closed this as not planned Won't fix, can't repro, duplicate, stale Feb 10, 2023
@miniak
Copy link
Contributor

miniak commented Feb 10, 2023

Related to #36985

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

No branches or pull requests

2 participants