I have a problem. In my HTML pages, I have a lot of Webp images that I can visualize only using Google Chrome. With other browsers like Mozilla, Explore, and Safari I can't see them.
Is there a solution? Maybe without change every image's extension (cause they are a lot)?
Thanks
According to caniuse, currently 79.2% of browsers support the WebP image format. That would include Chrome, Firefox, and Edge. Safari will support WebP in version 14, which is expected to be released in September 2020.
BROWSER SUPPORT FOR WebP Image FormatChrome 4 to 8 does not support for WebP Image Format. Chrome 9 to 22 partially supports WebP Image Format. Partial support in older Chrome, Opera and Android refers to browsers not supporting lossless and alpha versions of WebP. Chrome 23 to 67 supports for WebP Image Format.
WebP is bitstream-compatible with VP8 and uses 14 bits for width and height. The maximum pixel dimensions of a WebP image is 16383 x 16383.
WebP image format is Fully Supported on Microsoft Edge 94.
You need to fallback to a supported image format.
Below's example is using the <picture>
element and the <source>
elements with an img
element fallback. The browser will try loading the assets inside the <picture>
element from top to bottom until all the "conditions were satisfied" (optional sizes
attribute and complex srcset
which aren't in the below code) and the content format is supported.
<picture>
<source srcset="image.webp" type="image/webp">
<source srcset="image.jpg" type="image/jpeg">
<img src="image.jpg" alt="">
</picture>
You can use Modernizr's .no-webp
class name to target non-support browsers and serve a non-webp format instead:
.no-webp .elementWithBackgroundImage {
background-image: url("image.jpg");
}
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With