[英]Get a return value from Electron's webContents.executeJavaScript with NodeIntegration disabled - Possible?
[英]How i get events in electron webcontents?
我正在使用电子应用程序。 在 BrowserView 中使用网页内容。
我可以在此 webcontents Events 中获取事件吗?
我只是试过这样
view.Webcontents.on("Media-play",function(){
console.log("blah-blah-");
})
但是我拿不到。
我想处理类似的事件
我如何获得这些事件?
网页内容:
电子网页内容的事件监听器:
const { BrowserWindow } = require('electron')
let win = new BrowserWindow({ width: 800, height: 1500 })
win.loadURL('http://github.com');
win.webContents.on('did-finish-load', () => {
console.log('finished to load ');
})
可能的 WebContent 事件。 参考: https : //www.electronjs.org/docs/api/web-contents#instance-events
网页浏览:
电子webviews
事件侦听webviews
。
HTML:
<webview id="webview" src="content.html"></webview>
JS:
let webview = document.getElementById("webview");
webview.addEventListener("dom-ready", () => {
console.log("blah-blah-");
});
可能的 webview dom 事件。 参考: https : //www.electronjs.org/docs/api/webview-tag#dom-events
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.