Skip to content

Instantly share code, notes, and snippets.

@theArina
Created November 10, 2021 18:43
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save theArina/aed561dbe680ea3b62de1a23f1f7ed55 to your computer and use it in GitHub Desktop.
Save theArina/aed561dbe680ea3b62de1a23f1f7ed55 to your computer and use it in GitHub Desktop.
electron-14-webview-warning
<!DOCTYPE html>
<html>
<body>
<webview
style="height:97vh"
src="https://example.com"
webpreferences="nativeWindowOpen=no"
/>
</body>
</html>
const { app, BrowserWindow } = require('electron');
process.traceProcessWarnings = true;
app.on('ready', () => {
let mainWindow = new BrowserWindow({
show: true,
webPreferences: {
contextIsolation: false,
webviewTag: true,
nodeIntegration: true,
nodeIntegrationInSubFrames: true,
plugins: true,
javascript: true,
nativeWindowOpen: false
}
});
mainWindow.loadFile(`${__dirname}/index.html`);
mainWindow.on('closed', () => mainWindow = null);
});
{
"name": "webivew-example",
"version": "1.0.0",
"main": "main.js",
"scripts": {
"start": "electron ."
},
"keywords": [],
"dependencies": {
"electron": "14.0.0"
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment