How do I target only Internet Explorer 10 for certain situations like Internet Explorer-specific CSS or Internet Explorer-specific JavaScript code?

前端 未结 25 3264
谎友^
谎友^ 2020-11-22 06:19

How do I target only Internet Explorer 10 for certain situations like Internet Explorer-specific CSS or Internet Explorer-specific JavaScript code?

I tried this, but

25条回答
  •  深忆病人
    2020-11-22 06:29

    You could use feature detection to see if browser is IE10 or greater like so:

    var isIE = false;
    if (window.navigator.msPointerEnabled) {
        isIE = true;
    }
    

    Only true if > IE9

提交回复
热议问题