File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -22,7 +22,8 @@ const {
2222 app,
2323 BrowserWindow,
2424 ipcMain,
25- Menu
25+ Menu,
26+ shell
2627} = require ( 'electron' )
2728
2829// Initialize global variables early - BEFORE any windows are created
@@ -80,6 +81,12 @@ function createmainWindow(token, authWindow) {
8081
8182 mainWindow . setResizable ( false ) ;
8283
84+ // External links open in the user's default browser, not an in-app window.
85+ mainWindow . webContents . setWindowOpenHandler ( ( { url } ) => {
86+ shell . openExternal ( url ) ;
87+ return { action : 'deny' } ;
88+ } ) ;
89+
8390 // and load the index.html of the app.
8491 mainWindow . loadURL ( 'file://' + __dirname + '/index.html' , {
8592 userAgent : 'Chrome'
@@ -140,6 +147,13 @@ function createauthWindow() {
140147 } ) ;
141148 authWindow . setResizable ( false ) ;
142149
150+ // Open external links (e.g. the "new version available" banner) in the user's
151+ // default browser instead of a cramped in-app Electron window.
152+ authWindow . webContents . setWindowOpenHandler ( ( { url } ) => {
153+ shell . openExternal ( url ) ;
154+ return { action : 'deny' } ;
155+ } ) ;
156+
143157 // Load your custom loading page first
144158 authWindow . loadURL ( `file://${ __dirname } /auth-loading.html` ) ;
145159
You can’t perform that action at this time.
0 commit comments