Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

> 5% of people can't view them, yet 25% of top websites use them?

That's not how it works.

The server declares what versions of media it has, and the client requests a supported media format. The same trick have been used for audio and video for ages too.

Example:

    <picture>
        <source srcset="a.webp" type="image/webp">
        <img src="fallback.jpg">
    </picture>





This problem was solved by HTTP since forever. Client sends `Accept` header with supported formats and server selects the necessary content with corresponding `Content-Type` header. You don't need any HTML tags for it.

No, cause thats just one of the features.

Images are often at different resolutions too, that way, depending on the pixel density of the device, and the physical size, the browser can select the photo that has high enough resolution, but not one that is needlessly large, while also selecting the preferred image format.


What about file extensions?

File extensions are just a hint about what the file might be and have nothing to do with what the file actually is. If the server sets the MIME type, the browser will use that as the hint.

But even beyond that, most file formats have a bit of a header at the start of the file that declares the actual format of the file. Browsers already can understand that and use the correct render for a file without an extension.


What if the user wants to use the file outside the browser, where they do not have access to the HTTP headers?

The same is true, if you rename a .png to .jpg and opening it with an image viewer, it will render.

Sometimes respected, largely ignored. URLs very often don't map directly to files served.

Images almost always do.

I wish, would make my job a good bit easier. Sometimes they don't even respect format query parameters and just use whatever's in your Accept headers.

Will say though that it's not universal, it depends heavily on the corner of the internet you're on.




Consider applying for YC's Fall 2025 batch! Applications are open till Aug 4

Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: