Skip to content

Instantly share code, notes, and snippets.

@yuya-oc
Last active March 10, 2016 15:37
Show Gist options
  • Save yuya-oc/83398072d54acde7b4aa to your computer and use it in GitHub Desktop.
Save yuya-oc/83398072d54acde7b4aa to your computer and use it in GitHub Desktop.
ElectronでBrowserWindowやwebviewの証明書エラーに対処する ref: http://qiita.com/yuya-oc/items/2764bf7a33c751498858
app.on('certificate-error', function(event, webContents, url, error, certificate, callback) {
event.preventDefault();
callback(true);
});
app.on('certificate-error', function(event, webContents, url, error, certificate, callback) {
event.preventDefault();
electron.dialog.showMessageBox(mainWindow, {
title: 'Certificate error',
message: `Do you trust certificate from "${certificate.issuerName}"?`,
detail: `URL: ${url}\nError: ${error}`,
type: 'warning',
buttons: [
'Yes',
'No'
],
cancelId: 1
}, function(response) {
if (response === 0) {
callback(true);
}
else {
callback(false);
}
});
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment