diff --git a/src/main/labview/labview.ts b/src/main/labview/labview.ts index e18bb647..08f9a2fb 100644 --- a/src/main/labview/labview.ts +++ b/src/main/labview/labview.ts @@ -6,7 +6,8 @@ import { clipboard, dialog, Menu, - MenuItemConstructorOptions + MenuItemConstructorOptions, + shell } from 'electron'; import log from 'electron-log'; import * as path from 'path'; @@ -63,6 +64,17 @@ export class LabView implements IDisposable { } }); + // Open external links in system browser + this._view.webContents.setWindowOpenHandler(({ url }) => { + const jlab_host = `${sessionConfig.url.protocol}//${sessionConfig.url.host}` + if (url.startsWith(jlab_host)) { + return { action: 'allow'}; + } else { + shell.openExternal(url); + return { action: 'deny' }; + } + }); + this._view.setBackgroundColor( options.isDarkTheme ? DarkThemeBGColor : LightThemeBGColor );