From fe3d91dbd518875c96c243bba07b8549b521690f Mon Sep 17 00:00:00 2001 From: Shlok Amin Date: Wed, 14 Feb 2024 17:14:42 -0500 Subject: [PATCH] feat(app): disable external links from opening in ODD (#14472) closes RQA-2318 --- app-shell-odd/src/ui.ts | 13 ++++--------- 1 file changed, 4 insertions(+), 9 deletions(-) diff --git a/app-shell-odd/src/ui.ts b/app-shell-odd/src/ui.ts index fdae0e8a54d..0df99089dc2 100644 --- a/app-shell-odd/src/ui.ts +++ b/app-shell-odd/src/ui.ts @@ -1,5 +1,5 @@ // sets up the main window ui -import { app, shell, BrowserWindow } from 'electron' +import { app, BrowserWindow } from 'electron' import path from 'path' import { sendReadyStatus } from '@opentrons/app/src/redux/shell' import { getConfig } from './config' @@ -58,14 +58,9 @@ export function createUi(dispatch: Dispatch): BrowserWindow { // eslint-disable-next-line @typescript-eslint/no-floating-promises mainWindow.loadURL(url, { extraHeaders: 'pragma: no-cache\n' }) - // open new windows ( { - if (disposition === 'new-window' && url === 'about:blank') { - shell.openExternal(url) - return { action: 'deny' } - } else { - return { action: 'allow' } - } + // never allow external links to open + mainWindow.webContents.setWindowOpenHandler(() => { + return { action: 'deny' } }) return mainWindow