Detecting WebP support
This is my solution – is taking around 6ms and I’m considering WebP is only a feature for a modern browser. Uses a different approach using canvas.toDataUrl() function instead of image as the way to detect the feature: function support_format_webp() { var elem = document.createElement(‘canvas’); if (!!(elem.getContext && elem.getContext(‘2d’))) { // was able or not … Read more