我希望检测用户是否在使用IE和Firefox浏览器,但我找不到相应的脚本。
我的代码如下:
$(document).ready(function(e) {
$.browser.chrome = /chrom(e|ium)/.test(navigator.userAgent.toLowerCase());
if($.browser.chrome){
alert(1);
//this work well
}
else if(//the browser is IE){alert(2);}
else if(//the browser is Firefox){alert(3);}
//The problem is that I don't know how to write a script for IE and FireFox browser for chrome is work fine
)};
$.browser
,那么您肯定不需要在代码中实现浏览器检测。无论哪种情况,都应考虑改用特性检测。 - WynandB