From a1509a554f384ccbdc54479d2b8e1dfb7c5cdb9f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C3=89tienne=20Deparis?= Date: Wed, 3 May 2023 01:34:07 +0200 Subject: [PATCH] Message to inform that in private browsing mode (on firefox) the application does not work because opening the cache is impossible --- public/js/metadata.js | 9 ++++++++- public/js/organization.js | 9 ++++++++- public/js/signature.js | 9 ++++++++- 3 files changed, 24 insertions(+), 3 deletions(-) diff --git a/public/js/metadata.js b/public/js/metadata.js index fcf92c6..990ca40 100644 --- a/public/js/metadata.js +++ b/public/js/metadata.js @@ -246,7 +246,14 @@ var pageUpload = async function() { document.getElementById('page-upload').classList.remove('d-none'); document.getElementById('page-metadata').classList.add('d-none'); document.getElementById('input_pdf_upload').focus(); - const cache = await caches.open('pdf'); + let cache; + try { + cache = await caches.open('pdf'); + } catch (e) { + console.error(e) + alert("Erreur d'accès au cache. Cette application ne fonctionne pas en mode de navigation privée"); + return; + } document.getElementById('input_pdf_upload').addEventListener('change', async function(event) { let filename = document.getElementById('input_pdf_upload').files[0].name; let response = new Response(document.getElementById('input_pdf_upload').files[0], { "status" : 200, "statusText" : "OK" }); diff --git a/public/js/organization.js b/public/js/organization.js index 669a980..524d3e2 100644 --- a/public/js/organization.js +++ b/public/js/organization.js @@ -740,7 +740,14 @@ var pageUpload = async function() { document.getElementById('page-upload').classList.remove('d-none'); document.getElementById('page-organization').classList.add('d-none'); document.getElementById('input_pdf_upload').focus(); - const cache = await caches.open('pdf'); + let cache; + try { + cache = await caches.open('pdf'); + } catch (e) { + console.error(e) + alert("Erreur d'accès au cache. Cette application ne fonctionne pas en mode de navigation privée"); + return; + } document.getElementById('input_pdf_upload').addEventListener('change', async function(event) { if(document.getElementById('input_pdf_upload').files[0].size > maxSize) { diff --git a/public/js/signature.js b/public/js/signature.js index 71d4135..ab2f82b 100644 --- a/public/js/signature.js +++ b/public/js/signature.js @@ -996,7 +996,14 @@ var pageUpload = async function() { document.getElementById('page-upload').classList.remove('d-none'); document.getElementById('page-signature').classList.add('d-none'); document.getElementById('input_pdf_upload').focus(); - const cache = await caches.open('pdf'); + let cache; + try { + cache = await caches.open('pdf'); + } catch (e) { + console.error(e) + alert("Erreur d'accès au cache. Cette application ne fonctionne pas en mode de navigation privée"); + return; + } document.getElementById('input_pdf_upload').addEventListener('change', async function(event) { if(document.getElementById('input_pdf_upload').files[0].size > maxSize) {