当在浏览器窗口中找不到页面时,是否有事件可以监听?
示例:
win = new BrowserWindow({
width: 800,
height: 600,
webPreferences: {
nodeIntegration: true
}
})
// url has typo
var url = __dirname + "indez.html";
console.log("Loading app: " + url);
win.loadFile(url);
答案 0 :(得分:0)
您可以听https://www.baeldung.com/spring-request-response-body。
win.webContents.on("did-fail-load", (event, errorCode) => {
console.log("did-fail-load - errorCode:", errorCode);
});