v155 · jpeg xl
Decode probe
There is no registry to ask whether a browser supports an image format — you decode a file and see. Four different ways of asking, run against a real 30 KB .jxl, because they can disagree: the Accept header advertises intent, and only a successful decode is proof.
Ask four ways
Running…
| probe | result | what it proves |
|---|
The file itself
On the left, the .jxl in an <img>. On the right, the same source as PNG so you can see what it should look like. If the left pane is blank, this browser cannot decode JPEG XL — which is the honest outcome on anything before Chrome 155.
code path
// The only probe that proves decoding: get bytes, decode them, look for
// a bitmap. Everything else is an assertion of intent.
const response = await fetch("photo.jxl");
const supported = await createImageBitmap(await response.blob())
.then((bitmap) => { bitmap.close(); return true; })
.catch(() => false);