When using the webview tag, a blank page appeared. At first I thought it was not effective, but later I found that the page had this tag, but no content was displayed. Then I checked the official website and found that by default, the webview tag is in Electron > = 5 is disabled.
<webview id="foo" src="https://www.baidu.com/" style="display:inline-flex; width:840px; height:980px"></webview>
If you need to use it, you need to configure it separately: configure it separately in BrowserWindow to enable it.
const mainWindow = new BrowserWindow({
width: 800,
height: 600,
webPreferences: {
webviewTag: true,
preload: path.join(__dirname, 'preload.js')
}
})
After it is turned on, it will be displayed: