在检查上一个答案的解决方案后,我想到了这一点。
mainWindow.webContents.on('new-window', function(e, url) { e.preventDefault(); require('electron').shell.openExternal(url);});根据电子规格,
new-window单击外部链接时会触发。
注意:要求您target="_blank"
在锚标记上使用。

在检查上一个答案的解决方案后,我想到了这一点。
mainWindow.webContents.on('new-window', function(e, url) { e.preventDefault(); require('electron').shell.openExternal(url);});根据电子规格,
new-window单击外部链接时会触发。
注意:要求您target="_blank"
在锚标记上使用。