第160天 怎么检测浏览器是否支持HTML5特性?
'localStorage' in window;
function supportCanvas() { return !!document.createElement('canvas').getContext; }
function supportVideoType() { return document.createElement("video").canPlayType('video/mp4;codecs="avc1.42E01E,mp4a.40.2"'); }
function supportColorType () { var i = document.createElement("input") // HTML支持`color` i.setAttribute("type", "color"); console.log(i.type) return i.type !== "text"//text为默认的type }
写一个canvas 里面可以写一行文字例如:你的浏览器不支持html5,这样的 或者是用
Most helpful comment