Skip to content

Instantly share code, notes, and snippets.

@jeremyspiegel
Last active December 1, 2022 20:02
Show Gist options
  • Save jeremyspiegel/f55a7257b2b312b00e20aa63777b7f9a to your computer and use it in GitHub Desktop.
Save jeremyspiegel/f55a7257b2b312b00e20aa63777b7f9a to your computer and use it in GitHub Desktop.
dark-mode-text-popup-bug
const {app, BrowserWindow} = require('electron')
const http = require('http')
http
.createServer((request, response) => {
if (request.url === '/popup') {
response.writeHead(200, {'content-type': 'text/plain; charset=utf-8'})
response.end('test')
} else {
response.writeHead(200, {'content-type': 'text/html; charset=utf-8'})
response.end(`<html><body><button onclick="window.open('/popup')">Open Window</button></body></html>`)
}
})
.listen(2000);
app.whenReady().then(() => {
const mainWindow = new BrowserWindow({width: 200, height: 200})
mainWindow.webContents.setWindowOpenHandler(() => ({action: 'allow'}))
mainWindow.loadURL('http://localhost:2000')
})
{
"name": "exciting-spring-drink-8h31j",
"productName": "exciting-spring-drink-8h31j",
"description": "My Electron application description",
"keywords": [],
"main": "./main.js",
"version": "1.0.0",
"author": "jeremyspiegel",
"scripts": {
"start": "electron ."
},
"dependencies": {},
"devDependencies": {
"electron": "22.0.0"
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment