var $mfunc=function(){
return {
//This function determines the browser type. For simplicity, it returns a numerical representation,
//1.ie6;2.ie7; 3.ie8;4.ie5.5;5, Firefox;6.chrome;7 .Opera;8.Safari;0. Undetectable browser
//Other browsers can add it themselves
whichOS:function(){
var useragent=navigator.userAgent.toLowerCase();
return (/MSIE 6/i.test(useragent)==true&&1)||
(/MSIE 7/i.test(useragent)==true&&2)||
(/MSIE 8/i.test (useragent)==true&&3)||
(/MSIE 5/i.test(useragent)==true&&4)||
(/Firefox/i.test(useragent)==true&&5)||
(/Chrome/i.test(useragent)==true&&6)||
(/Opera/i.test(useragent)==true&&7)||
(/Safari/i.test(useragent)= =true&&8)||0
}
}
}()
Pay attention to the && and ||, the explanations are all in the comments
Statement:The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn