Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Téléchargement Blob non supporté sur DuckDuckGo #149

Open
thenotilus opened this issue Nov 11, 2020 · 2 comments
Open

Téléchargement Blob non supporté sur DuckDuckGo #149

thenotilus opened this issue Nov 11, 2020 · 2 comments

Comments

@thenotilus
Copy link

Bonjour,
La génération du PDF sur le site https://media.interieur.gouv.fr/attestation-couvre-feu-covid-19/ lance le téléchargement d'un blob.
blob:https://media.interieur.gouv.fr/d2edae4e-b9fc-4e5d-b41a-96334af16d46
Il semblerait que cela ne fonctionne pas sur le navigateur Duck Duck Go (Android) et sur celui de Lilo.org (Android)
Serait-il possible d'apporter un rapide Fix ?

@thenotilus
Copy link
Author

Après plusieurs lectures, j'ai l'impression que la prise en charge du téléchargement des blob est incomplète sur le projet.
voir function downloadBlob (blob, fileName)
Le projet d'origine https://github.com/nesk/covid-19-certificate/blob/master/certificate.js a le même comportement

@Mueslint
Copy link

Si c'est toujours ouvert vous pouvez testez ça

export function downloadBlob (blob, fileName) {
  const userAgent = navigator.userAgent || navigator.vendor || window.opera;
  const unSupportedDevicesRegExp = /iPad|iPhone|iPod/g;

  if (unSupportedDevicesRegExp.test(userAgent) && !window.MSStream) {
    const reader = new FileReader();
    reader.onload = function (_e) {
      window.location.href = reader.result;
    };
    reader.readAsDataURL(blob);

  } else {
    const link = createElement('a')
    const url = URL.createObjectURL(blob)
    link.href = url
    link.download = fileName
    document.body.appendChild(link)
    link.click()
  }
}

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants