hebrerillo Posted November 15, 2023 Share Posted November 15, 2023 I developed a server side script to check if the browser supports webp format images by checking the "image/webp" string in the accept request headers. The problem is that recent versions of Safari, even though they support Webp, they do not send the string "image/webp" in the headers. Why?? How can I check if the Safari browser supports webp?? Quote Link to comment https://forums.phpfreaks.com/topic/317444-safari-do-not-send-imagewebp-in-accept-headers/ Share on other sites More sharing options...
requinix Posted November 15, 2023 Share Posted November 15, 2023 You can't. Not from PHP. But Safari on any Mac that's been updated in the last couple years will support it. There are client-side options, if you really need to know. Or you could just, you know, not serve WEBPs to Safari. 1 Quote Link to comment https://forums.phpfreaks.com/topic/317444-safari-do-not-send-imagewebp-in-accept-headers/#findComment-1612891 Share on other sites More sharing options...
hebrerillo Posted November 15, 2023 Author Share Posted November 15, 2023 (edited) @requinix thank you so much for your answer! I know a client-side solution like this one, but that would mean blocking JavaScript which will delay the page rendering. I want to serve WEBP images to Safari if supported. Maybe I could detect in PHP if the request was performed using Safari and its version to serve Webp images. Thank you anyway 🙂 Edited November 15, 2023 by hebrerillo Quote Link to comment https://forums.phpfreaks.com/topic/317444-safari-do-not-send-imagewebp-in-accept-headers/#findComment-1612901 Share on other sites More sharing options...
maxxd Posted November 16, 2023 Share Posted November 16, 2023 According to https://caniuse.com/?search=webp safari has supported webp since November 2020 on Big Sur or above. I can't remember what OsX is on now, but again according to caniuse.com it's been completely supported since September 2022. You're probably OK to assume it's safe to use. Quote Link to comment https://forums.phpfreaks.com/topic/317444-safari-do-not-send-imagewebp-in-accept-headers/#findComment-1612916 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.