在Electron中找不到页面时在BrowserWindow上发生事件?

时间:2019-06-13 03:01:32

标签: electron

当在浏览器窗口中找不到页面时,是否有事件可以监听?

示例:

  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);

1 个答案:

答案 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);
  });
相关问题