From cce3ce4cfa0df793a354c69f8e67cbbd8963ab40 Mon Sep 17 00:00:00 2001 From: wukko Date: Sun, 28 Jul 2024 13:49:23 +0600 Subject: [PATCH] web/download: show saving dialog if new tab got blocked --- web/src/lib/download.ts | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/web/src/lib/download.ts b/web/src/lib/download.ts index 34d1a3ad..61143371 100644 --- a/web/src/lib/download.ts +++ b/web/src/lib/download.ts @@ -13,7 +13,12 @@ export const openSavingDialog = (url: string) => }) export const openURL = (url: string) => { - return window.open(url, "_blank"); + const open = window.open(url, "_blank"); + + /* if new tab got blocked by user agent, show a saving dialog */ + if (!open) { + openSavingDialog(url); + } } export const shareURL = async (url: string) => {