如何使用jQuery检测IE11 [英] how to detect IE11 using jquery

查看:193
本文介绍了如何使用jQuery检测IE11的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有代码$ .browser来检测浏览器,并根据结果生成一些布局样式. 但是现在有了ie 11,$.browser将提供mozilla v.11.有修理建议吗?

I have codes $.browser to detect the browser and upon the result some layout style is based. but now with ie 11, $.browser would give mozilla v.11. any suggestion to repair ?

推荐答案

尝试一下:

var isIE11 = !!navigator.userAgent.match(/Trident.*rv\:11\./);
alert(isIE11);

在正则表达式修复程序中进行了编辑,摘自注释.截至2014年2月17日,此修复程序可在当前版本的IE11中使用.

Editted in a regex fix, taken from the comments. This fix works in the current version of IE11 as of 2/17/2014.

这篇关于如何使用jQuery检测IE11的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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