Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

electron how to allow insecure https

Tags:

electron

Loading https://github.com works fine for exmaple.
But loading an insecure https, the page displays empty.

I've done some research and tried the 3 flags (webSecurity, allowDisplayingInsecureContent, allowRunningInsecureContent) below with no success.

Looking for any known solutions. Thank you.

const { BrowserWindow } = require('electron').remote;

    let win = new BrowserWindow({
        width: 800,
        height: 600,
        webPreferences: {
            plugins: true,
            nodeIntegration: false,
            webSecurity: false,
            allowDisplayingInsecureContent: true,
            allowRunningInsecureContent: true
        }
    });

    win.loadURL('https://insecure...')
like image 302
Cristian Muscalu Avatar asked Jun 20 '17 16:06

Cristian Muscalu


1 Answers

In main.js, do:

const { app } = require('electron')

app.commandLine.appendSwitch('ignore-certificate-errors')
like image 67
Paulo Henrique Avatar answered Nov 17 '22 11:11

Paulo Henrique