const checkWebp = () => {
try {
return document.createElement('canvas').toDataURL('image/webp').indexOf('data:image/webp') === 0
} catch(e) {
return false
}
}
检测浏览器版本是否支持webp
奋斗就是每天很难,可是一年一年却越来越容易;
不奋斗就是每天很容易,可是一年一年却越来越难。
const checkWebp = () => {
try {
return document.createElement('canvas').toDataURL('image/webp').indexOf('data:image/webp') === 0
} catch(e) {
return false
}
}