Skip to content

Instantly share code, notes, and snippets.

<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<title>Hello World!</title>
<link rel="stylesheet" type="text/css" href="./styles.css">
</head>
<body>
<h1>Hello World!</h1>
<!-- All of the Node.js APIs are available in this renderer process. -->
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8" />
<title></title>
</head>
<body>
Display is <span id="size"></span>
<script src="renderer.js"></script>
(async () => {
const {app, BrowserWindow} = require("electron");
await app.whenReady()
const window = new BrowserWindow();
await window.loadURL("https://google.com");
window.webContents.print(
{
margins: {
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8" />
<title></title>
</head>
<body>
Display is <span id="size"></span>
<script src="renderer.js"></script>
</body>
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8" />
<title></title>
</head>
<body>
Display is <span id="size"></span>
<script src="renderer.js"></script>
</body>
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<!-- https://developer.mozilla.org/en-US/docs/Web/HTTP/CSP -->
<meta http-equiv="Content-Security-Policy" content="default-src 'self'; script-src 'self'">
<meta http-equiv="X-Content-Security-Policy" content="default-src 'self'; script-src 'self'">
<title>Hello World!</title>
</head>
<body>
@ckerr
ckerr / index.html
Created February 24, 2021 19:11
simple app to test a textarea
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<title>Hello World!</title>
<link rel="stylesheet" type="text/css" href="./styles.css">
</head>
<body>
<h1>Hello World!</h1>
<!-- All of the Node.js APIs are available in this renderer process. -->
const {app, BrowserWindow} = require('electron');
const path = require('path');
var mainWindow;
async function init(url) {
// load about:blank first, just in case, before attaching debugger
// (doesn't seem to make a difference)
await mainWindow.loadURL("about:blank");
process.exitCode = 1;
process.exit();

Project to reproduce exception stack member (bug?) in Electron 11.

npm install
npm run start

will show something like: