"Check for webP"
Bootstrap 4.1.1 Snippet by sdcarte

<link href="//maxcdn.bootstrapcdn.com/bootstrap/4.1.1/css/bootstrap.min.css" rel="stylesheet" id="bootstrap-css"> <script src="//maxcdn.bootstrapcdn.com/bootstrap/4.1.1/js/bootstrap.min.js"></script> <script src="//cdnjs.cloudflare.com/ajax/libs/jquery/3.2.1/jquery.min.js"></script> <!------ Include the above in your HEAD tag ----------> <div class="container"> <div class="row"> <h2>Create your snippet's HTML, CSS and Javascript in the editor tabs</h2> </div> </div> <div class="log"></div>
$(document).ready(function() { var hasWebP = false; var img = new Image(); img.onload = function() { hasWebP = !!(img.height > 0 && img.width > 0); if(hasWebP){e = "enabled";}else{e = "not supported"} $(".log").html(e); }; img.onerror = function() { hasWebP = false; if(hasWebP){e = "enabled";}else{e = "not supported"} $(".log").html(e); }; img.src = 'https://www.gstatic.com/webp/gallery/1.webp'; });

Related: See More


Questions / Comments: