Skip to content

Instantly share code, notes, and snippets.

@Jelmerro
Created February 21, 2022 21:33
Show Gist options
  • Save Jelmerro/85ed80e274eb40ba3e7138f6ea30b888 to your computer and use it in GitHub Desktop.
Save Jelmerro/85ed80e274eb40ba3e7138f6ea30b888 to your computer and use it in GitHub Desktop.
Webview crash bad Mojo Message
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title>Hello World!</title>
</head>
<body>
<webview></webview>
</body>
</html>
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)
{
"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"
}
}
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