<?xml version="1.0" encoding="UTF-8" standalone="yes" ?>
<!DOCTYPE bugzilla SYSTEM "https://bugs.webkit.org/page.cgi?id=bugzilla.dtd">

<bugzilla version="5.0.4.1"
          urlbase="https://bugs.webkit.org/"
          
          maintainer="admin@webkit.org"
>

    <bug>
          <bug_id>263608</bug_id>
          
          <creation_ts>2023-10-24 13:12:24 -0700</creation_ts>
          <short_desc>TXT and XML Files open in tab on iOS Safari instead of downloading</short_desc>
          <delta_ts>2024-09-09 13:58:53 -0700</delta_ts>
          <reporter_accessible>1</reporter_accessible>
          <cclist_accessible>1</cclist_accessible>
          <classification_id>1</classification_id>
          <classification>Unclassified</classification>
          <product>WebKit</product>
          <component>DOM</component>
          <version>Safari 16</version>
          <rep_platform>Unspecified</rep_platform>
          <op_sys>Unspecified</op_sys>
          <bug_status>NEW</bug_status>
          <resolution></resolution>
          
          <see_also>https://bugs.webkit.org/show_bug.cgi?id=167341</see_also>
          <bug_file_loc></bug_file_loc>
          <status_whiteboard></status_whiteboard>
          <keywords>InRadar</keywords>
          <priority>P2</priority>
          <bug_severity>Normal</bug_severity>
          <target_milestone>---</target_milestone>
          
          
          <everconfirmed>1</everconfirmed>
          <reporter name="Celeste Glavin">cglavin</reporter>
          <assigned_to name="Nobody">webkit-unassigned</assigned_to>
          <cc>aron</cc>
    
    <cc>bugmail</cc>
    
    <cc>ddkilzer</cc>
    
    <cc>laszlo.alt</cc>
    
    <cc>ppoollllxx</cc>
    
    <cc>webkit-bug-importer</cc>
          

      

      

      

          <comment_sort_order>oldest_to_newest</comment_sort_order>  
          <long_desc isprivate="0" >
    <commentid>1987209</commentid>
    <comment_count>0</comment_count>
    <who name="Celeste Glavin">cglavin</who>
    <bug_when>2023-10-24 13:12:24 -0700</bug_when>
    <thetext>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) =&gt; {
  const a = document.createElement(&apos;a&apos;);
  a.href = url;
  a.download = &apos;&apos;;
  a.click();
};</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>1987231</commentid>
    <comment_count>1</comment_count>
    <who name="Radar WebKit Bug Importer">webkit-bug-importer</who>
    <bug_when>2023-10-24 14:10:54 -0700</bug_when>
    <thetext>&lt;rdar://problem/117435170&gt;</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>2004421</commentid>
    <comment_count>2</comment_count>
    <who name="pollx">ppoollllxx</who>
    <bug_when>2024-01-11 06:29:40 -0800</bug_when>
    <thetext>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(&apos;a&apos;)
    link.href = blobUrl
    link.download = filename
    link.click()</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>2040464</commentid>
    <comment_count>3</comment_count>
    <who name="Laszlo">laszlo.alt</who>
    <bug_when>2024-06-07 19:03:23 -0700</bug_when>
    <thetext>I get the same result with pictures as well.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>2040465</commentid>
    <comment_count>4</comment_count>
    <who name="Laszlo">laszlo.alt</who>
    <bug_when>2024-06-07 19:03:37 -0700</bug_when>
    <thetext>I get the same result with pictures as well.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>2058711</commentid>
    <comment_count>5</comment_count>
    <who name="">aron</who>
    <bug_when>2024-09-09 13:35:06 -0700</bug_when>
    <thetext>I&apos;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.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>2058714</commentid>
    <comment_count>6</comment_count>
    <who name="Laszlo">laszlo.alt</who>
    <bug_when>2024-09-09 13:58:53 -0700</bug_when>
    <thetext>(In reply to aron from comment #5)
&gt; I&apos;m having the same problem with plain old html. I have also confirmed that
&gt; the server serves the file with the attachment content disposition, and it
&gt; works on desktop safari but not ios. 
&gt; 
&gt; 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.</thetext>
  </long_desc>
      
      

    </bug>

</bugzilla>