Last active
March 10, 2016 15:37
-
-
Save yuya-oc/83398072d54acde7b4aa to your computer and use it in GitHub Desktop.
ElectronでBrowserWindowやwebviewの証明書エラーに対処する ref: http://qiita.com/yuya-oc/items/2764bf7a33c751498858
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
app.on('certificate-error', function(event, webContents, url, error, certificate, callback) { | |
event.preventDefault(); | |
callback(true); | |
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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