Skip to content

Instantly share code, notes, and snippets.

@t57ser
Created September 8, 2021 22:41
Show Gist options
  • Save t57ser/886de25d244907a32c01fb1147d59ce0 to your computer and use it in GitHub Desktop.
Save t57ser/886de25d244907a32c01fb1147d59ce0 to your computer and use it in GitHub Desktop.
webview stays blank when navigating to facebook and crashes after another navigation
<!DOCTYPE html>
<html>
<head></head>
<style>
body {
position: absolute;
top: 0;
left: 0;
right: 0;
bottom: 0;
}
webview {
position: absolute;
top: 0;
left: 0;
right: 0;
bottom: 0;
}
</style>
<body>
<webview id="test" src="http://www.google.com"/>
</body>
<script>
setTimeout(() => {
document.getElementById("test").openDevTools({mode: "detach"});
}, 2000);
</script>
</html>
const { app, BrowserWindow } = require("electron");
const init = () => {
let browserWindow = new BrowserWindow({
show: true,
webPreferences: {
webviewTag: true,
}
});
browserWindow.webContents.loadFile("index.html");
};
app.on("ready", () => {
init();
});
{
"main": "main.js",
"scripts": {
"start": "electron ."
},
"devDependencies": {
"electron": "14.0.0"
},
"dependencies": {
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment