How can you detect the version of a browser?

后端 未结 28 2643
佛祖请我去吃肉
佛祖请我去吃肉 2020-11-21 23:35

I\'ve been searching around for code that would let me detect if the user visiting the website has Firefox 3 or 4. All I have found is code to detect the type of browser but

28条回答
  •  Happy的楠姐
    2020-11-22 00:13

    var ua = navigator.userAgent;
    
    if (/Firefox\//.test(ua))
       var Firefox = /Firefox\/([0-9\.A-z]+)/.exec(ua)[1];
    

提交回复
热议问题