我正在使用样板 Electron js快速入门,并尝试从其API文档渲染Webview。这是我的index.html
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<title>Hello World!</title>
</head>
<body>
<webview id="foo" src="https://www.github.com/" style="display:inline-flex; width:640px; height:480px"></webview></webview>
</body>
</html>
它只是呈现一个空白屏幕。我在Ubuntu和OSX上尝试过。控制台中没有错误。我什至不知道从哪里开始调试。
最佳答案
mainWindow = new BrowserWindow({
width: 1280,
height: 1080,
webPreferences: {
preload: path.join(__dirname, 'preload.js'),
webviewTag: true
},
})
创建浏览器窗口时,必须在webPreferences内启用webviewTag。
关于html - Webview在electronic js中返回空白白页,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/58210650/