检测JS中的所有Firefox版本 [英] Detect all Firefox versions in JS

查看:102
本文介绍了检测JS中的所有Firefox版本的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

如何在JavaScript中检测Firefox?

我想检测所有版本的Firefox。

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

推荐答案

<

var isFirefox = navigator.userAgent.toLowerCase().indexOf('firefox') > -1;

更具体地说:

more specifically:

if(navigator.userAgent.toLowerCase().indexOf('firefox') > -1){
     // Do Firefox-related activities
}

您可能要考虑使用功能检测ala Modernizr 或一个相关的工具,来完成你所需要的。

You may want to consider using feature-detection ala Modernizr, or a related tool, to accomplish what you need.

这篇关于检测JS中的所有Firefox版本的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆