From 72735c8cd4135d280f8d30ebda9416c415ca1beb Mon Sep 17 00:00:00 2001 From: liamcottle Date: Sun, 29 Dec 2024 20:18:30 +1300 Subject: [PATCH] fix opening blob urls in new electron window --- electron/main.js | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/electron/main.js b/electron/main.js index 3084f39..d58ce1d 100644 --- a/electron/main.js +++ b/electron/main.js @@ -111,10 +111,22 @@ app.whenReady().then(async () => { // open external links in default web browser instead of electron mainWindow.webContents.setWindowOpenHandler(({ url }) => { + var shouldShowInNewElectronWindow = false; + // we want to open call.html in a new electron window // but all other target="_blank" links should open in the system web browser // we don't want /rnode-flasher/index.html to open in electron, otherwise user can't select usb devices... if(url.startsWith("http://localhost") && url.includes("/call.html")){ + shouldShowInNewElectronWindow = true; + } + + // we want to open blob urls in a new electron window + else if(url.startsWith("blob:")) { + shouldShowInNewElectronWindow = true; + } + + // open in new electron window + if(shouldShowInNewElectronWindow){ return { action: "allow", };