Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

185
Views
Cómo reaccionar al clic del botón en la aplicación Electron

Por favor, ¿podría pedir ayuda con lo siguiente?

He clonado la aplicación de inicio Electron así:

clon de git https://github.com/electron/electron-quick-start

Y tenerlo funcionando.

He añadido una línea:

 <button id="doitButton" onclick="alert('t')">DoIt</button>

Aquí está en el contexto del archivo main.js:

 <!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'; style-src 'self' 'unsafe-inline'"> <link href="./styles.css" rel="stylesheet"> <title>Hello World!</title> </head> <body> <h1>Hello World!</h1> <button id="doitButton" onclick="alert('t')">DoIt</button> We are using Node.js <span id="node-version"></span>, Chromium <span id="chrome-version"></span>, and Electron <span id="electron-version"></span>. <!-- You can also require other files to run in this process --> <script src="./renderer.js"></script> </body> </html>

Estoy trabajando en VSCode. Estoy seguro de guardar el archivo y luego ejecuto "npm start".

Veo el botón, pero no hay alerta cuando hago clic en él. ¿Qué he hecho mal?

Gracias por cualquier ayuda.

about 4 years ago · Juan Pablo Isaza
1 answers
Answer question

0

He encontrado una solución.

Si comento la línea:

 <meta http-equiv="Content-Security-Policy" content="default-src 'self'; script-src 'self'; style-src 'self' 'unsafe-inline'">

Entonces veo aparecer la alerta.

about 4 years ago · Juan Pablo Isaza Report
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!