Detect all Firefox versions in JS

前端 未结 7 1895
-上瘾入骨i
-上瘾入骨i 2020-11-27 03:04

How to detect Firefox in JavaScript?
I want to detect all versions of Firefox.

相关标签:
7条回答
  • 2020-11-27 04:06

    the best solution for me:

    function GetIEVersion() {
      var sAgent = window.navigator.userAgent;
      var Idx = sAgent.indexOf("MSIE");
      // If IE, return version number.
      if (Idx > 0)
        return parseInt(sAgent.substring(Idx+ 5, sAgent.indexOf(".", Idx)));
    
      // If IE 11 then look for Updated user agent string.
      else if (!!navigator.userAgent.match(/Trident\/7\./))
        return 11;
    
      else
        return 0; //It is not IE
    
    }
    if (GetIEVersion() > 0){
    			 alert("This is IE " + GetIEVersion());
    		}else {
    			 alert("This no is IE ");
    		}		

    0 讨论(0)
提交回复
热议问题