snipt

Ctrl+h for KB shortcuts

JavaScript

WebP Image with Fallback

<img src="image.webp" onerror="this.onerror=null; this.src='image.png'">
https://snipt.net/embed/3129a92b49c67565ace361fb10dedc62/
/raw/3129a92b49c67565ace361fb10dedc62/
3129a92b49c67565ace361fb10dedc62
js
JavaScript
1
2019-06-17T05:27:19
True
False
False
Apr 08, 2014 at 09:22 AM
/api/public/snipt/114585/
webp-image-with-fallback
<table class="highlighttable"><tr><td class="linenos"><div class="linenodiv"><pre><a href="#L-1">1</a></pre></div></td><td class="code"><div class="highlight"><pre><span></span><span id="L-1"><a name="L-1"></a><span class="o">&lt;</span><span class="nx">img</span> <span class="nx">src</span><span class="o">=</span><span class="s2">&quot;image.webp&quot;</span> <span class="nx">onerror</span><span class="o">=</span><span class="s2">&quot;this.onerror=null; this.src=&#39;image.png&#39;&quot;</span><span class="o">&gt;</span> </span></pre></div> </td></tr></table>
image, img, js, webp