js recognizes the code for the uc browser

  • 2020-10-07 18:32:05
  • OfStack

It's actually pretty simple


if(navigator.userAgent.indexOf('UCBrowser') > -1) {
alert("uc The browser ");
}else { 
// not uc The action performed by the browser 
 } 

If you want to test a browser's characteristics, you can get them by doing the following

JS gets browser information
Browser code name: ES8en.appCodeName
Browser name: ES11en.appName
Browser version: ES14en.appVersion
Support for Java: navigator.javaEnabled()
MIME type (array) : ES22en.mimeTypes
System platform: ES25en. platform
Plug-in (array) : ES28en.plugins
User agent: ES31en.ES32en

To compare the


<script type="text/javascript"> 
document.write(' The browser tells: ');
var OsObject=navigator.userAgent;
//  Contains" Opera "Text columns  
if(OsObject.indexOf("Opera") != -1) 
{ 
   document.write(' Your browser is Opera ? '); 
} 
//  Contains" MSIE "Text columns  
else if(OsObject.indexOf("MSIE") != -1) 
{ 
   document.write(' Your browser is Internet Explorer ? '); 
} 
//  Contains" chrome "Text columns   , but 360 The browser copies it chrome the UA

else if(OsObject.indexOf("Chrome") != -1) 
{ 
  document.write(' Your browser is chrome or 360 A browser? '); 
}
//  Contains" UCBrowser "Text columns  
else if(OsObject.indexOf("UCBrowser") != -1) 
{ 
  document.write(' Your browser is UCBrowser ? '); 
}
//  Contains" BIDUBrowser "Text columns  
else if(OsObject.indexOf("BIDUBrowser") != -1) 
{ 
  document.write(' Is your browser Baidu Browser? '); 
}
//  Contains" Firefox "Text columns  
else if(OsObject.indexOf("Firefox") != -1) 
{ 
  document.write(' Your browser is Firefox ? '); 
}
//  Contains" Netscape "Text columns  
else if(OsObject.indexOf("Netscape") != -1)
{ 
  document.write(' Your browser is Netscape ? '); 
} 
//  Contains" Safari "Text columns  
else if(OsObject.indexOf("Safari") != -1) 
{ 
   document.write(' Your browser is Safari  ? '); 
} 
else{ 
  document.write(' Unrecognized browser. '); 
} 
</script> 

Many browsers today are based on chrome, 360, Cheetah, etc


Related articles: