JSFiddle - React, Tailwind, and code Playground
by Pointy
HTML
<div id='x'></div>
JavaScript
function hasWebP() {
var rv = $.Deferred(), img = new Image();
img.onload = function() { rv.resolve(); };
img.onerror = function() { rv.reject(); };
img.src = "http://www.gstatic.com/webp/gallery/1.webp";
return rv.promise();
}
hasWebP().then(function() {
$('#x').text("Hooray!! WebP is enabled. Things will be wonderful now.");
}, function() {
$('#x').text("Note: your browser does not support the new Google WebP format. Please remain where you are while our support team locates you to begin the reeducation process.");
});