In Javascript, how do I determine if my current browser is Firefox on a computer vs everything else?

后端 未结 13 1887
萌比男神i
萌比男神i 2020-12-01 07:13
if(firefox and is on a computer){
alert(\'using firefox on a computer\')
}else{
alert(\"using something else!\");
}

How can I do this?

13条回答
  •  心在旅途
    2020-12-01 08:07

    It's better to detect features you need, not a browser. For example, if you need to know if foo() is supported, you can check it with if(foo){}

提交回复
热议问题