chore: use webContents.setWindowOpenHandler() in default-app (#34308)

This commit is contained in:
Milan Burda 2022-05-24 10:23:56 +02:00 committed by GitHub
parent 9d3fc9c794
commit 6667de28e3
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -66,9 +66,9 @@ async function createWindow (backgroundColor?: string) {
mainWindow = new BrowserWindow(options);
mainWindow.on('ready-to-show', () => mainWindow!.show());
mainWindow.webContents.on('new-window', (event, url) => {
event.preventDefault();
shell.openExternal(decorateURL(url));
mainWindow.webContents.setWindowOpenHandler(details => {
shell.openExternal(decorateURL(details.url));
return { action: 'deny' };
});
mainWindow.webContents.session.setPermissionRequestHandler((webContents, permission, done) => {