From 381e456dd4f472ab04c5e7904d4935dd49222255 Mon Sep 17 00:00:00 2001 From: Roy Hashimoto Date: Thu, 2 Nov 2023 11:06:24 -0700 Subject: [PATCH] Use a hidden anchor element in the file demo. --- demo/file/index.html | 1 + demo/file/index.js | 5 ++++- 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/demo/file/index.html b/demo/file/index.html index 26086461..b73998bb 100644 --- a/demo/file/index.html +++ b/demo/file/index.html @@ -16,6 +16,7 @@

Sample database import/export

+

diff --git a/demo/file/index.js b/demo/file/index.js index 2f68eab1..b2ac3b5e 100644 --- a/demo/file/index.js +++ b/demo/file/index.js @@ -33,7 +33,10 @@ document.getElementById('file-export').addEventListener('click', async () => { const url = new URL('./export', location.href); url.searchParams.set('idb', IDB_NAME); url.searchParams.set('db', DB_NAME); - window.open(url); + + const a = /** @type {HTMLAnchorElement} */(document.getElementById('file-download')); + a.href = url.href; + a.click(); }); document.getElementById('file-import').addEventListener('change', async event => {