diff options
author | Mahadevan Sreenivasan <mahadevan_sv@yahoo.com> | 2020-04-29 18:15:46 +0000 |
---|---|---|
committer | GitHub <noreply@github.com> | 2020-04-29 18:15:46 +0000 |
commit | 5a197d26d364409cb1457c4b30041a8f298fba56 (patch) | |
tree | 3115e8d32be9ed06d1028c9539d8fdef42ce9c99 | |
parent | docs: add gega7 as a contributor (#684) (diff) | |
download | ferdium-app-5a197d26d364409cb1457c4b30041a8f298fba56.tar.gz ferdium-app-5a197d26d364409cb1457c4b30041a8f298fba56.tar.zst ferdium-app-5a197d26d364409cb1457c4b30041a8f298fba56.zip |
Prevent unnecessary electron popup windows for links (#685)
-rw-r--r-- | src/index.js | 8 | ||||
-rw-r--r-- | src/stores/ServicesStore.js | 3 |
2 files changed, 10 insertions, 1 deletions
diff --git a/src/index.js b/src/index.js index 027884826..85aa9d1b9 100644 --- a/src/index.js +++ b/src/index.js | |||
@@ -192,6 +192,14 @@ const createWindow = () => { | |||
192 | }, | 192 | }, |
193 | }); | 193 | }); |
194 | 194 | ||
195 | app.on('web-contents-created', (e, contents) => { | ||
196 | if (contents.getType() === 'webview') { | ||
197 | contents.on('new-window', (event) => { | ||
198 | event.preventDefault(); | ||
199 | }); | ||
200 | } | ||
201 | }); | ||
202 | |||
195 | mainWindow.webContents.on('did-finish-load', () => { | 203 | mainWindow.webContents.on('did-finish-load', () => { |
196 | const fns = onDidLoadFns; | 204 | const fns = onDidLoadFns; |
197 | onDidLoadFns = null; | 205 | onDidLoadFns = null; |
diff --git a/src/stores/ServicesStore.js b/src/stores/ServicesStore.js index 0ad523374..a8d9cc1fb 100644 --- a/src/stores/ServicesStore.js +++ b/src/stores/ServicesStore.js | |||
@@ -631,7 +631,8 @@ export default class ServicesStore extends Store { | |||
631 | } | 631 | } |
632 | 632 | ||
633 | @action _openWindow({ event }) { | 633 | @action _openWindow({ event }) { |
634 | if (event.disposition !== 'new-window' && event.url !== 'about:blank') { | 634 | if (event.url !== 'about:blank') { |
635 | event.preventDefault(); | ||
635 | this.actions.app.openExternalUrl({ url: event.url }); | 636 | this.actions.app.openExternalUrl({ url: event.url }); |
636 | } | 637 | } |
637 | } | 638 | } |