0
votes

I am trying to display a webp image on my webpage. I tried many solutions, but every solution has issues on ios device only. The webp is not showing, and also in some cases if you try to download such image in Chrome on ios, it shows the image as txt file.

The current solution is:

<picture class="image mb-5 mb-md-3">
    <source srcset="mywebpimage.webp" type="image/webp">
    <source srcset="myjpgimage.jpg" type="image/jpeg">
    <img src="myjpgimage.jpg" alt="alt">
</picture>

I also tried a php solution - checking the webp support in browsers via http_accept.

    $webp_support = false;
if (isset($_SERVER["HTTP_ACCEPT"])) {
    if (strpos($_SERVER["HTTP_ACCEPT"], "image/webp") > 0) {
        $webp_support = true;
    }
}

This is also working fine except ios.

So is the ios chrome browser cursed or has no support for webp? If I echo the $_SERVER["HTTP_ACCEPT"] on ios, it says TRUE. But if I echo $webp_support on ios chrome browser, it says FALSE.

So it seems webp is not supported, or is there a special way displaying webp on ios?

1

1 Answers

2
votes

"iOS Chrome" is...

... just iOS Safari Mobile with a Chrome skin.

Neither Safari nor iOS Safari Mobile support WebP (yet).

See: https://caniuse.com/#search=webp