<script src="js/feature.js"></script> if (feature.webGL) { console.log("你的浏览器支持WebGL"); } else { console.log("你的浏览器不支持WebGL"); }
下面是Feature.js可进行的浏览器检测的特性列表。
- feature.async
- feature.addEventListener
- feature.canvas
- feature.classList
- feature.cors
- feature.contextMenu
- feature.css3Dtransform
- feature.cssTransform
- feature.cssTransition
- feature.defer
- feature.deviceMotion
- feature.deviceOrientation
- feature.geolocation
- feature.historyAPI
- feature.placeholder
- feature.localStorage
- feature.matchMedia
- feature.pictureElement
- feature.querySelectorAll
- feature.remUnit
- feature.serviceWorker
- feature.sizes
- feature.srcset
- feature.svg
- feature.touch
- feature.viewportUnit
- feature.webGL
Feature.js浏览器特性检测插件的github地址为: https://github.com/viljamis/feature.js