Created
February 21, 2022 21:33
-
-
Save Jelmerro/85ed80e274eb40ba3e7138f6ea30b888 to your computer and use it in GitHub Desktop.
Webview crash bad Mojo Message
This file contains hidden or 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> | |
<meta charset="utf-8"> | |
<title>Hello World!</title> | |
</head> | |
<body> | |
<webview></webview> | |
</body> | |
</html> |
This file contains hidden or 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 {join} = require('path') | |
function createWindow () { | |
const mainWindow = new BrowserWindow({ | |
width: 800, | |
height: 600, | |
webPreferences: { | |
preload: join(__dirname, 'preload.js'), | |
contextIsolation: false, | |
webviewTag: true | |
} | |
}) | |
mainWindow.loadFile('index.html') | |
mainWindow.webContents.on("will-attach-webview", (_, prefs) => { | |
prefs.webSecurity = false | |
}) | |
} | |
app.whenReady().then(createWindow) |
This file contains hidden or 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
{ | |
"name": "traditional-throne-draw-biutx", | |
"productName": "traditional-throne-draw-biutx", | |
"description": "My Electron application description", | |
"keywords": [], | |
"main": "./main.js", | |
"version": "1.0.0", | |
"author": "jelmerro", | |
"scripts": { | |
"start": "electron ." | |
}, | |
"dependencies": {}, | |
"devDependencies": { | |
"electron": "18.0.0-alpha.3" | |
} | |
} |
This file contains hidden or 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
window.addEventListener("DOMContentLoaded", () => { | |
const webview = document.querySelector("webview") | |
webview.addEventListener("dom-ready", () => webview.openDevTools()) | |
webview.src = "https://habr.com" | |
}) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment