web/download: show saving dialog if new tab got blocked

This commit is contained in:
wukko 2024-07-28 13:49:23 +06:00
parent 299d1867a2
commit cce3ce4cfa
No known key found for this signature in database
GPG key ID: 3E30B3F26C7B4AA2

View file

@ -13,7 +13,12 @@ export const openSavingDialog = (url: string) =>
}) })
export const openURL = (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) => { export const shareURL = async (url: string) => {