3 ms·
> because doing some content negotiation is more code, more work It's actually not more work. The user's browser automatically handles the content negotiation
by alwillis 1y ago
> because doing some content negotiation is more code, more work
It's actually not more work. The user's browser automatically handles the content negotiation and only downloads the image format it understands:
<picture>
<source srcset="photo.jxl" type="image/jxl">
<source srcset="photo.webp" type="image/webp">
<img src="photo.jpg" alt="Product photo" loading="lazy">
</picture>
macOS, iPadOS and iOS get the JPEG-XL image, device that can handle WebP get that and everything else gets JPEG.
There are several image delivery services that will provide the best image format depending on the device that's connecting.