Created
May 7, 2021 11:24
-
-
Save dannycroft/45483727d6ed3828e238eac570b4eff4 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const isWebpSupported = () => | |
new Promise((resolve, reject) => { | |
const img = new Image(); | |
img.onload = () => resolve(true); | |
img.onerror = () => reject(false); | |
img.src = 'data:image/webp;base64,UklGRh4AAABXRUJQVlA4TBEAAAAvAAAAAAfQ//73v/+BiOh/AAA='; | |
}); | |
isWebpSupported().then(console.log).catch(console.error) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment