Electron中提示:Refused to execute inline event handler because it violates
生活随笔
收集整理的这篇文章主要介绍了
Electron中提示:Refused to execute inline event handler because it violates
小编觉得挺不错的,现在分享给大家,帮大家做个参考.
场景
在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
注:
博客:
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的全部内容,希望文章能够帮你解决所遇到的问题。
- 上一篇: Winform中导出Excel数据量百万
- 下一篇: Electron中 提示:Uncaugh