Steps to reproduce: - define an anchor element with the download attribute and a url to download either a TXT or XMl file - fire the click event on iOS Safari (Current version is 16.6.1) Expected: - Download starts Actual: - file is opened in the current tab Example of code: const downloadExportUrl = (url) => { const a = document.createElement('a'); a.href = url; a.download = ''; a.click(); };
<rdar://problem/117435170>
Same issue when trying to download a pdf file in the form of Blob: const pdfBlob = await pdfBinaryRes.blob() const blobUrl = window.URL.createObjectURL(pdfBlob) const link = document.createElement('a') link.href = blobUrl link.download = filename link.click()
I get the same result with pictures as well.