js判断浏览器类型

判断各种浏览器

if(navigator.userAgent.indexOf(“MSIE”)>0){
 //ie

}else if(navigator.userAgent.indexOf(“<a target="_self">Firefox</a>“)&gt;0){
   //firefox
}else if(navigator.userAgent.indexOf(“<a target="_self">Chrome</a>“)&gt;0){
  //chrome
}else if(navigator.userAgent.indexOf(“Safari”)&gt;0){
  //safari
}else{
  //this part can be used as opera area
}

广告


JackSun

JackSun

I'm a coder.

You may also like...

Leave a Reply

Your email address will not be published.