Bug 263608

Summary: TXT and XML Files open in tab on iOS Safari instead of downloading
Product: WebKit Reporter: Celeste Glavin <cglavin>
Component: DOMAssignee: Nobody <webkit-unassigned>
Status: NEW    
Severity: Normal CC: aron, bugmail, ddkilzer, laszlo.alt, ppoollllxx, webkit-bug-importer
Priority: P2 Keywords: InRadar
Version: Safari 16   
Hardware: Unspecified   
OS: Unspecified   
See Also: https://bugs.webkit.org/show_bug.cgi?id=167341

Celeste Glavin
Reported 2023-10-24 13:12:24 PDT
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(); };
Attachments
Radar WebKit Bug Importer
Comment 1 2023-10-24 14:10:54 PDT
pollx
Comment 2 2024-01-11 06:29:40 PST
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()
Laszlo
Comment 3 2024-06-07 19:03:23 PDT
I get the same result with pictures as well.
Laszlo
Comment 4 2024-06-07 19:03:37 PDT
I get the same result with pictures as well.
aron
Comment 5 2024-09-09 13:35:06 PDT
I'm having the same problem with plain old html. I have also confirmed that the server serves the file with the attachment content disposition, and it works on desktop safari but not ios. The link I have is to a different sub-domain incase that helps.
Laszlo
Comment 6 2024-09-09 13:58:53 PDT
(In reply to aron from comment #5) > I'm having the same problem with plain old html. I have also confirmed that > the server serves the file with the attachment content disposition, and it > works on desktop safari but not ios. > > The link I have is to a different sub-domain incase that helps. I had another bug somewhere on webkit and they responded that the issue lies with Safari and the Safari was notified of the issue. It will be tracked internally in the Safari team so we will not know the status of it going forward.
Note You need to log in before you can comment on or make changes to this bug.