WebKit Bugzilla
New
Browse
Log In
×
Sign in with GitHub
or
Remember my login
Create Account
·
Forgot Password
Forgotten password account recovery
NEW
Bug 225562
Send the supported image mimetypes in the HTTP request header for main resource
https://bugs.webkit.org/show_bug.cgi?id=225562
Summary
Send the supported image mimetypes in the HTTP request header for main resource
yann
Reported
2021-05-08 13:20:32 PDT
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 <source> 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: <picture> <source srcset="path/to/my/1x/image.jxl 1x, path/to/my/2x/image.jxl 2x"> <source srcset="path/to/my/1x/image.avif 1x, path/to/my/2x/image.avif 2x"> <source srcset="path/to/my/1x/image.webp 1x, path/to/my/2x/image.webp 2x"> <img src="path/to/my/1x/image.jpg" srcset="path/to/my/1x/image.jpg 1x, path/to/my/2x/image.jpg 2x"> </picture> Chrome and Firefox, on the other hand, since they're sending the list of the format they support, can receive: <img srcset="path/to/my/image.jxl 1x, path/to/my/image.jxl 2x"> 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's way more complicated. Plus, the Accept header Safari is currently sending is not that great, since it's possible to type the URL of an image directly into the address bar. In that case, even a server-side mechanism won't be able to chose the most appropriate file to send, since Safari won'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 :-)
Attachments
Add attachment
proposed patch, testcase, etc.
Radar WebKit Bug Importer
Comment 1
2021-05-11 10:54:34 PDT
<
rdar://problem/77854289
>
mxdvl
Comment 2
2023-08-22 12:49:35 PDT
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.
Note
You need to
log in
before you can comment on or make changes to this bug.
Top of Page
Format For Printing
XML
Clone This Bug