Empresas
Empleos
  • Sobre nosotros
  • Soluciones
    • Publicación de vacantes
      Publica tu vacante y recibe candidatos calificados en 48h.
    • Evaluación de candidatos
      500+ pruebas técnicas y psicológicas, más anti-fraude.
    • Headhunting
      Búsqueda ejecutiva a la medida de principio a fin.
    • Nómina + EOR
      Dispersión de nómina y EOR en más de 15 países de LATAM.
  • Precios
  • Empleos

0

134
Vistas
target=_blank based link in webview in electron.js are not opening when nativeWindowOpen is true in parent window

I have simple electron.js application, electron-quick-start in which I am using <webview>.

By default links in which target=_blank is set does not open inside webview.

There is some workaround by listening to new-window event given at Can't open Electron webview links with target = blank

But this workaround does not work when nativeWindowOpen: true in webPreferences in parent window. Rather application get crashed when I am adding allowpopups on MacOS with error exited with signal SIGSEGV

const mainWindow = new BrowserWindow({
    width: 800,
    height: 600,
    webPreferences: {
      preload: path.join(__dirname, 'preload.js'),
      webviewTag: true,
      nativeWindowOpen: true // This flag is not letting recieve new-window event from webview
    }
  })

index.html is

<!DOCTYPE html>
<html>
  <head>
    <meta charset="UTF-8">
    <!-- https://developer.mozilla.org/en-US/docs/Web/HTTP/CSP -->
    <meta http-equiv="Content-Security-Policy" content="default-src 'self'; script-src 'self'">
    <meta http-equiv="X-Content-Security-Policy" content="default-src 'self'; script-src 'self'">
    <title>Hello World!</title>
  </head>
  <body>
    <h1>Hello World!</h1>
    <webview id="foo" src="https://www.w3schools.com/tags/att_a_target.asp" style="display:inline-flex; width:640px; height:480px" allowpopups></webview>

    <h1>click on Try it yuorself button in webview</h1>

    <!-- You can also require other files to run in this process -->
    <!-- <script src="./renderer.js"></script> -->
  </body>
</html>

How can I get webview links where target=_blank working keeping nativeWindowOpen: true in parent window?

nativeWindowOpen is going to be set true by default according to Planned Breaking API Changes (15.0)

about 4 years ago · Juan Pablo Isaza
2 Respuestas
Responde la pregunta

0

I've tried and write a gist with Electron fiddle. Perhaps I didn't catch your problem but for me it's working https://gist.github.com/deb6ed0fa37860fdfc0d51c6782f4152

about 4 years ago · Juan Pablo Isaza Denunciar

0

This was a bug https://github.com/electron/electron/pull/29874 which got fixed.

electron version 12.0.14 or higher is working fine for this problem.

about 4 years ago · Juan Pablo Isaza Denunciar
Responde la pregunta
Encuentra empleos remotos

¡Descubre la nueva forma de encontrar empleo!

Top de empleos
Top categorías de empleo
Empresas
Publicar vacante Precios Comercial
Legal
Términos y condiciones Política de privacidad
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomiéndame algunas ofertas
Necesito ayuda