Skip to content

Instantly share code, notes, and snippets.

@KazuyaHayashi
Created November 7, 2021 07:58
Show Gist options
  • Save KazuyaHayashi/33372ae657dde602e68fdb50aabafa31 to your computer and use it in GitHub Desktop.
Save KazuyaHayashi/33372ae657dde602e68fdb50aabafa31 to your computer and use it in GitHub Desktop.
Minimum code to reproduce `setContentProtection` issue
const { app, BrowserWindow } = require('electron')
const path = require('path')
function createWindow () {
const win = new BrowserWindow({
width: 800,
height: 600,
})
win.loadURL("https://www.google.com");
}
app.whenReady().then(() => {
createWindow()
app.on('activate', () => {
if (BrowserWindow.getAllWindows().length === 0) {
createWindow()
}
})
})
app.on('window-all-closed', () => {
if (process.platform !== 'darwin') {
app.quit()
}
})
app.on("browser-window-created", (event, window) => {
window.setContentProtection(false);
});
{
"name": "my-electron-app",
"version": "1.0.0",
"description": "Hello World!",
"main": "main.js",
"author": "Jane Doe",
"license": "MIT",
"scripts": {
"start": "electron ."
},
"devDependencies": {
"electron": "15.2.0"
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment