Created
September 8, 2021 22:41
-
-
Save t57ser/886de25d244907a32c01fb1147d59ce0 to your computer and use it in GitHub Desktop.
webview stays blank when navigating to facebook and crashes after another navigation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<!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> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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(); | |
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{ | |
"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