本文介绍了浏览器检测jQuery 1.9的最简单/最轻便的替换方法?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

昨天我有几个客户抱怨某些代码停止工作.显然,它归结为使用现已弃用的jQuery.browser插件,该插件昨天在jQuery 1.9发行时停止工作.

I had several clients complain yesterday that some code stopped working. Apparently it comes down to plug-ins using the now deprecated jQuery.browser which stopped working yesterday when jQuery 1.9 was released.

我(快速地)看了一下1.9更改文档,它似乎,就像他们希望我只用一些非常繁重的库来代替那个一个函数一样.

I (quickly) looked at the 1.9 change docs and it seems like they want me to substitute some pretty heavy libraries just for that one function.

是否建议使用重量最轻的插件或代码段来恢复该功能?

Is there a recommended lightest weight plug-in or code snippet to restore that functionality?

对于这些站点的需求,这是非常基本的;我只需要对IE,FF和其他所有人进行最基本的检测即可.

For what these sites need, it's very basic; I only need the most basic detection of IE vs FF vs everyone else.

建议?

推荐答案

我使用了Alexx Roche回答的以下代码,但我想这样检测MSIE:

I've use the following code answered by Alexx Roche, but i wanted to detect MSIE so:

<script type="text/javascript">
   $(document).ready(function() {
      if (navigator.userAgent.match(/msie/i) ){
        alert('I am an old fashioned Internet Explorer');
      }
   });
</script>

希望有帮助!

这篇关于浏览器检测jQuery 1.9的最简单/最轻便的替换方法?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

08-14 21:37