i tried a few JS webp detection,
but they all always failed in safari on ios. How is this possible? I have the latest version of IOS, both Iphone 12 and 13, and friends with Iphones are reporting this as well.
Is there a problem?
For example, this function
function checkWebPSupport(callback) {
var canvas = document.createElement('canvas');
if (canvas.toDataURL('image/webp').indexOf('data:image/webp') === 0) {
// WebP is supported
callback(true);
} else {
// WebP is not supported
callback(false);
}
}
// Usage
checkWebPSupport(function(supported) {
if (supported) {
console.log("WebP is supported");
} else {
console.log("WebP is not supported");
}
});
Can anyone advise me what really works?