JS to identify the UC browser code _javascript skills

Source: Internet
Author: User

Actually, it's pretty simple.

if (navigator.userAgent.indexOf (' Ucbrowser ') >-1) {
alert ("UC Browser");
} else{
//Is not an operation performed by the UC browser
}

If you want to test the characteristics of a browser, you can use the following methods to obtain

JS Get browser information
Browser code Name: Navigator.appcodename
Browser name: Navigator.appname
Browser version number: Navigator.appversion
Support for Java: navigator.javaenabled ()
MIME type (array): Navigator.mimetypes
System platform: Navigator.platform
Plugins (arrays): Navigator.plugins
User agent: Navigator.useragent

More complete.

<script type= "Text/javascript" > document.write (' browser sentence: ');
var osobject=navigator.useragent; Contains "opera" text columns if (Osobject.indexof ("opera")!=-1) {document.write (' Your browser is Opera? 
'); ///contains "msie" text column else if (Osobject.indexof ("MSIE")!=-1) {document.write (' Your browser is Internet Explorer? 
'); //contains "chrome" text columns, but 360 browsers also copy Chrome's UA else if (Osobject.indexof ("Chrome")!=-1) {document.write (' Your browser is chrome or 36 0 browsers, right? 
'); ///contains "ucbrowser" text column else if (Osobject.indexof ("Ucbrowser")!=-1) {document.write (' Your browser is Ucbrowser? 
'); ///contains "bidubrowser" text column else if (Osobject.indexof ("Bidubrowser")!=-1) {document.write (' Your browser is Baidu browser? 
'); ///contains "firefox" text column else if (Osobject.indexof ("Firefox")!=-1) {document.write (' Your browser is Firefox? 
'); ///contains "netscape" text column else if (Osobject.indexof ("Netscape")!=-1) {document.write (' Your browser is Netscape? 
'); ///contains "safari" text column else if (Osobject.indexof ("Safari")!=-1) {document.write (' Your browser is Safari? 
'); } else{DocumEnt.write (' Unrecognized browser. 
');  } </script>

Now many browsers are based on Chrome browser, 360, Cheetah browser, etc.

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.