File tree 1 file changed +11
-2
lines changed
1 file changed +11
-2
lines changed Original file line number Diff line number Diff line change @@ -24,6 +24,11 @@ export function mainIsReady() {
24
24
mainIsReadyResolver ( ) ;
25
25
}
26
26
27
+ function isWebProtocol ( url : string ) {
28
+ const { protocol } = new URL ( url ) ;
29
+ return [ 'http' , 'https' ] . includes ( protocol ) ;
30
+ }
31
+
27
32
/**
28
33
* Gets default options for the main window
29
34
*
@@ -92,13 +97,17 @@ export function createMainWindow(): Electron.BrowserWindow {
92
97
} ) ;
93
98
94
99
browserWindow . webContents . setWindowOpenHandler ( ( details ) => {
95
- shell . openExternal ( details . url ) ;
100
+ if ( isWebProtocol ( details . url ) ) {
101
+ shell . openExternal ( details . url ) ;
102
+ }
96
103
return { action : 'deny' } ;
97
104
} ) ;
98
105
99
106
browserWindow . webContents . on ( 'will-navigate' , ( event , url ) => {
100
107
event . preventDefault ( ) ;
101
- shell . openExternal ( url ) ;
108
+ if ( isWebProtocol ( details . url ) ) {
109
+ shell . openExternal ( url ) ;
110
+ }
102
111
} ) ;
103
112
104
113
ipcMainManager . on ( IpcEvents . RELOAD_WINDOW , ( ) => {
You can’t perform that action at this time.
0 commit comments