disabled creation of new windows

pull/1472/head
antelle 2020-04-17 21:50:53 +02:00
parent 349ec59df7
commit 6d781a6358
No known key found for this signature in database
GPG Key ID: 094A2F2D6136A4EE
1 changed files with 7 additions and 1 deletions

View File

@ -104,6 +104,12 @@ app.on('second-instance', () => {
restoreMainWindow();
}
});
app.on('web-contents-created', (event, contents) => {
contents.on('new-window', async (e, url) => {
e.preventDefault();
emitRemoteEvent('log', { message: `Prevented new window: ${url}` });
});
});
app.restartApp = function() {
restartPending = true;
mainWindow.close();
@ -235,8 +241,8 @@ function createMainWindow() {
});
mainWindow.webContents.on('will-navigate', (e, url) => {
if (!url.startsWith('https://beta.keeweb.info/') && !url.startsWith(htmlPath)) {
emitRemoteEvent('log', { message: `Prevented navigation: ${url}` });
e.preventDefault();
emitRemoteEvent('log', { message: `Prevented navigation: ${url}` });
}
});
perfTimestamps &&