What is the Best way to do Browser Detection in Javascript?

前端 未结 8 1849
自闭症患者
自闭症患者 2020-12-05 16:55

In one of my Web Development classes we where asked to create a script that detects NE4,NE6+,IE4,IE6+ Browsers that display a compatable CSS script for each browser.

8条回答
  •  没有蜡笔的小新
    2020-12-05 17:26

    You'll want to use Conditionizr, which features robust test/detect add-ons for this: http://conditionizr.com

    For example:

    conditionizr.add('safari', [], function () {
        return /constructor/i.test(window.HTMLElement);
    });
    

提交回复
热议问题