在Electron中点击index.html中的button按钮时想要其触发renderer.js的方法。

在index.html中

<button onclick="getProcessInfo()">查看Process信息</button>

在js中

function getProcessInfo()
{
    console.log("getProcessInfo************************");
}

然后提示:

Refused to execute inline event handler because it violates

Electron中提示:Refused to execute inline event handler because it violates

 

 

注:

博客:
https://blog.csdn.net/badao_liumang_qizhi
关注公众号
霸道的程序猿
获取编程相关电子书、教程推送与免费下载。

实现

修改为通过在html中给button添加id,然后在js中通过getElementById获取

<button id="buttonProcess" >查看Process信息</button>

然后在js中

var btn=document.getElementById('buttonProcess');
    
btn.onclick=getProcessInfo;

 function getProcessInfo()
{
    console.log("getProcessInfo**********************");

}

效果

Electron中提示:Refused to execute inline event handler because it violates

 

 

Electron中提示:Refused to execute inline event handler because it violates

 

相关文章:

  • 2021-12-16
  • 2021-07-26
  • 2021-05-21
  • 2021-12-26
  • 2022-12-23
  • 2022-12-23
  • 2021-08-21
  • 2021-06-11
猜你喜欢
  • 2022-12-23
  • 2021-08-09
  • 2022-12-23
  • 2021-09-04
  • 2022-12-23
  • 2021-07-05
  • 2021-11-21
相关资源
相似解决方案