Skip to content

Instantly share code, notes, and snippets.

@rhysd
Last active April 19, 2017 17:13
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save rhysd/68e3006d3c192faea22bb6e5106c81c5 to your computer and use it in GitHub Desktop.
Save rhysd/68e3006d3c192faea22bb6e5106c81c5 to your computer and use it in GitHub Desktop.
<!DOCTYPE html>
<html>
<body>
Hello, world.
</body>
</html>
const path = require('path');
const electron = require('electron');
const app = electron.app;
const BrowserWindow = electron.BrowserWindow;
app.on('ready', () => {
const win = new BrowserWindow({
webPreferences: {
sandbox: true
}
});
win.webContents.on('dom-ready', () => {
win.webContents.insertCSS('body { color: red !important; }');
console.log('CSS was inserted');
});
win.loadURL('file://' + path.join(__dirname, 'index.html'));
});
{
"name": "electron-bug",
"version": "0.0.0",
"main": "main.js",
"dependencies": {
"electron": "^1.6.7"
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment