Handle 'open-url' event: support "deep-linking" e.g. for mailto links (PR #1418, fix #1412)

This commit is contained in:
Sirisak Lueangsaksri 2022-05-30 20:40:13 +07:00 committed by GitHub
parent 59a4bb87f9
commit 0df5b8f617
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 9 additions and 0 deletions

View File

@ -228,6 +228,15 @@ app.on('will-finish-launching', () => {
log.debug('app.will-finish-launching');
});
app.on('open-url', (event, url) => {
log.debug('app.open-url', { event, url });
event.preventDefault();
if (mainWindow) {
mainWindow.webContents.send('open-url', url);
}
});
if (appArgs.widevine) {
// @ts-expect-error This event only appears on the widevine version of electron, which we'd see at runtime
app.on('widevine-ready', (version: string, lastVersion: string) => {