<?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>225562</bug_id>
          
          <creation_ts>2021-05-08 13:20:32 -0700</creation_ts>
          <short_desc>Send the supported image mimetypes in the HTTP request header for main resource</short_desc>
          <delta_ts>2023-08-22 12:49:35 -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>Images</component>
          <version>Safari 14</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=211735</see_also>
          <bug_file_loc></bug_file_loc>
          <status_whiteboard></status_whiteboard>
          <keywords>BrowserCompat, InRadar</keywords>
          <priority>P2</priority>
          <bug_severity>Normal</bug_severity>
          <target_milestone>---</target_milestone>
          
          
          <everconfirmed>1</everconfirmed>
          <reporter>yann</reporter>
          <assigned_to name="Nobody">webkit-unassigned</assigned_to>
          <cc>achristensen</cc>
    
    <cc>beidson</cc>
    
    <cc>hi+webkit</cc>
    
    <cc>sabouhallawa</cc>
    
    <cc>simon.fraser</cc>
    
    <cc>webkit-bug-importer</cc>
          

      

      

      

          <comment_sort_order>oldest_to_newest</comment_sort_order>  
          <long_desc isprivate="0" >
    <commentid>1758206</commentid>
    <comment_count>0</comment_count>
    <who name="">yann</who>
    <bug_when>2021-05-08 13:20:32 -0700</bug_when>
    <thetext>Hi,

It would be great if Safari was sending the accepted image mimetypes in the Accept header for a document request.
That could save us a lot of (almost) redundant &lt;source&gt; in the HTML code.

Chrome does it, Firefox does it, and Safari does it... but only for images request.
That forces the developer to either have a list of sources, or to rely on a server-based solution for images requests (with a meaningless extension).

Safari supports WebP, now, but new formats are coming, and I hope that Safari will support them soon.
With all these new formats, every image tag could quickly look like this:

&lt;picture&gt;
&lt;source srcset=&quot;path/to/my/1x/image.jxl 1x, path/to/my/2x/image.jxl 2x&quot;&gt;
&lt;source srcset=&quot;path/to/my/1x/image.avif 1x, path/to/my/2x/image.avif 2x&quot;&gt;
&lt;source srcset=&quot;path/to/my/1x/image.webp 1x, path/to/my/2x/image.webp 2x&quot;&gt;
&lt;img src=&quot;path/to/my/1x/image.jpg&quot; srcset=&quot;path/to/my/1x/image.jpg 1x, path/to/my/2x/image.jpg 2x&quot;&gt;
&lt;/picture&gt;

Chrome and Firefox, on the other hand, since they&apos;re sending the list of the format they support, can receive:
&lt;img srcset=&quot;path/to/my/image.jxl 1x, path/to/my/image.jxl 2x&quot;&gt;

Of course, we could also parse the Safari user-agent to know which formats are supported (and maintain that code when a new format is supported), but it&apos;s way more complicated.

Plus, the Accept header Safari is currently sending is not that great, since it&apos;s possible to type the URL of an image directly into the address bar.
In that case, even a server-side mechanism won&apos;t be able to chose the most appropriate file to send, since Safari won&apos;t tell which image formats it supports in the Accept header (Accept: text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8).

Thank you for reading this long text :-)</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>1758972</commentid>
    <comment_count>1</comment_count>
    <who name="Radar WebKit Bug Importer">webkit-bug-importer</who>
    <bug_when>2021-05-11 10:54:34 -0700</bug_when>
    <thetext>&lt;rdar://problem/77854289&gt;</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>1972699</commentid>
    <comment_count>2</comment_count>
    <who name="mxdvl">hi+webkit</who>
    <bug_when>2023-08-22 12:49:35 -0700</bug_when>
    <thetext>I’ve noticed that in Safari 16 the `Accept` header now seems correct for image requests that are part of an HTML document, but incorrect when loading an image directly.

For example, I get this request header on web pages I visit `Accept:image/avif,image/webp,…` (truncated for brevity) but the same `text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8` when opening the image in its own tab.</thetext>
  </long_desc>
      
      

    </bug>

</bugzilla>