V. Subhash's
Really Ultimate
Client-Sniffer JavaScript
Client sniffing used to be a fine art. It is now taboo. You are not supposed to do it. Feature detection and all that jazz. For what it is worth…
I use this client-sniffer javascript to add spice to my referrer logs. It detects:
- mobile phones - BlackBerry, T-Mobile Sidekick, HP-iPaQ, HTC, iPhone, Motorola, Nokia, Palm, Sagem, Samsung, Sharp, and Sony-Ericsson
- mobile-phone OSes - Android OS, Symbian OS, Windows CE/Windows Mobile, and Palm OS
- mobile-phone browsers - Maemo, Opera Mini, Blazer, NetFront, IE Mobile, Mobile Safari, Plucker and Xiinu
- game consoles - Sony PlayStation Portable, Sony Playstation 3, Nintendo Wii and Nintendo DS
- Internet-enabled devices - Apple iPad, Apple iPod and WebTV
- Internet-enabled applications - Mozilla Thunderbird, Adobe Acrobat and WebZip
- search engine spiders - Baidu, Become, SearchMe, Authoritative Web, LookSmart, Googlebot, Googlebot-Image, Alexa, MSNbot, rambler, Ask Teoma, Yahoo! Slurp, LookSmart Wisenut and other bots
- browsers - Netscape Navigator, Internet Explorer, Opera, Konqueror (KHTML, Apple Safari, Google Chrome), Mozilla (Firefox), Epiphany, OmniWeb, HotJava, and iCab
- operating systems - Amiga, Acorn (RISC OS), BeOS, OS2/Warp, OpenVMS, CygWin, Unix (IBM Aix, BSD, FreeBSD, Open BSD, HP-UX, Irix and Sun Solaris), Apple Mac OS, Microsoft Windows (Windows 3.1, Windows 95, Windows 98, Windows Me, Windows NT, Windows 2000, Windows Server 2003, Windows 2008, Windows XP, Windows Vista and Windows 7) and Linux (SliTaz GNU/Linux, Gentoo Linux, Mandrake Linux or Mandriva Linux, SUSE Linux, Cent OS, Red Hat Linux, PCLinuxOS, Linux Mint, Kubuntu Linux, Ubuntu Linux, Debian Linux and Fedora Linux), DeviceVM Splashtop
To use the functions get_BrowserName()
and
get_OsName()
, convert
the useragent to lower case and pass it as the argument ua
.
/* * Library: Really Ultimate Client-Sniffer JavaScript * * Function: Detects useragents including browsers, * search engine spiders, and other applications that * consume web pages. * * Usage: Pass lowercase'd useragent to the function * ~ navigator.userAgent.toLowerCase() * * Author: V. Subhash * Created: 28 July 2008 * Updated: 11 May 2013 * * Thanks: useragentstrings.com and zytrax.com * License: Share and share alike like GPL * * Website: http://www.vsubhash.com */ function get_BrowserName(ua) { /* * Search engine spiders */ if (ua.indexOf("abachobot") !=-1) { return("SE Spider (Abacho)"); // German/European SE } else if (ua.indexOf("abilogicbot") !=-1) { return("SE Spider (AbiLogic)"); // Web directory } else if (ua.indexOf("accoona") !=-1) { return("SE Spider (Accoona)"); } else if (ua.indexOf("anyapex") !=-1) { return("SE Spider (AnyApex)"); // Web directory } else if (ua.indexOf("arachmo") !=-1) { return("SE Spider (Arachmo)"); // Japanese } else if ((ua.indexOf("b-l-i-t-z-b-o-t") !=-1) || (ua.indexOf("blitzbot") !=-1)) { return("SE Spider (Tricus)"); // German/European SE } else if (ua.indexOf("baiduspider") !=-1) { return("SE Spider (Baidu)"); // Chinese SE } else if ((ua.indexOf("becomebot") !=-1) || (ua.indexOf("exabot") !=-1)) { return("SE Spider (Become)"); // Shopping portal } else if (ua.indexOf("bingbot") !=-1) { return("SE Spider (Bing Search)"); } else if (ua.indexOf("boitho") !=-1) { return("SE Spider (Boitho)"); // Failed Boitho.com } else if (ua.indexOf("btbot") !=-1) { // BTBot SE (btbot, ringtones, EI) return("SE Spider (btbot)"); } else if (ua.indexOf("cerberian") !=-1) { return("SE Spider (Cerberian Drtrs)"); } else if (ua.indexOf("charlotte") !=-1) { return("SE Spider (searchme.com)"); } else if (ua.indexOf("convera") !=-1) { return("SE Spider (Authoritative Web)"); } else if (ua.indexOf("everyfeed-spider") !=-1) { return("SE Spider (everyfeed.com)"); } else if (ua.indexOf("xyleme") !=-1) { return("SE Spider (Xyleme)"); // XML content SE } else if (ua.indexOf("dataparksearch") !=-1) { // GNU GPL site search return("SE Spider (DataparkSearch)"); } else if (ua.indexOf("emeraldshield") !=-1) { // Internet and mail filter return("SE Spider (EmeraldShield)"); } else if (ua.indexOf("envolk") !=-1) { return("SE Spider (Envolk)"); } else if (ua.indexOf("esperanzabot") !=-1) { return("SE Spider (EsperanzaBot)"); } else if ((ua.indexOf("fast enteprise") !=-1) || (ua.indexOf("fast-webcrawler") !=-1)) { return("SE Spider (FAST-WebCrawler)"); // Fast Search } else if (ua.indexOf("fdse robot") !=-1) { return("SE Spider (Fluid Dyamics Corp.))"); } else if (ua.indexOf("fulrbot") !=-1) { return("SE Spider (LookSmart)"); } else if (ua.indexOf("fyberspider") !=-1) { return("SE Spider (FyberSearch.com)"); } else if (ua.indexOf("geniebot") !=-1) { return("SE Spider (Genie Knows)"); // Local SE } else if (ua.indexOf("gigabot") !=-1) { return("SE Spider (GigaBlast)"); } else if (ua.indexOf("girafa") !=-1) { return("SE Spider (Girafa.com)"); } else if (ua.indexOf("googlebot-image") !=-1) { return("SE Spider (Google Image Search)"); } else if (ua.indexOf("googlebot") !=-1) { return("SE Spider (Google Search)"); } else if (ua.indexOf("hl_ftien_spider") !=-1) { return("SE Spider (Hl Ftien)"); // Chinese } else if (ua.indexOf("htdit") !=-1) { // SE for limited set of Intranet sites or HTML docs return("SE Spider (HT Dig)"); } else if (ua.indexOf("ia_archiver") !=-1) { return("SE Spider (Alexa)"); } else if (ua.indexOf("mogimogi") !=-1) { return("SE Spider (Goo.ne.jp)"); } else if (ua.indexOf("ichiro") !=-1) { return("SE Spider (Goo.ne.jp)"); } else if (ua.indexOf("issuecrawler") !=-1) { return("SE Spider (Govcom.org)"); // Networks } else if (ua.indexOf("jyxobot") !=-1) { return("SE Spider (Jyxo.cz)"); // Czech SE } else if (ua.indexOf("lapozzbot") !=-1) { return("SE Spider (lapozz.com)"); // Hungarian SE } else if (ua.indexOf("larbin") !=-1) { return("SE Spider (Larbin)"); // Multi-purpose } else if (ua.indexOf("mabontland") !=-1) { return("SE Spider (Mabontland.com)"); } else if (ua.indexOf("mediapartners-google") !=-1) { return("SE Spider (Google Adsense)"); } else if (ua.indexOf("mj12bot") !=-1) { return("SE Spider (Majestic 12)"); } else if (ua.indexOf("mnogosearch") !=-1) { return("SE Spider (Mnogosearch)"); // Limited SE } else if (ua.indexOf("mojeek") !=-1) { return("SE Spider (mojeek.com)"); } else if (ua.indexOf("morning paper") !=-1) { return("SE Spider (boutell.com)"); } else if (ua.indexOf("msnbot") !=-1) { return("SE Spider (MSN)"); } else if (ua.indexOf("noxtrumbot") !=-1) { return("SE Spider (noxtrum.com)"); } else if (ua.indexOf("msrbot") !=-1) { return("SE Spider (Microsoft Research)"); } else if (ua.indexOf("nusearch") !=-1) { return("SE Spider (Nusearch.com)"); } else if (ua.indexOf("nutchcvs") !=-1) { return("SE Spider (NutchCVS)"); // Open source robot } else if (ua.indexOf("omniexplorer_bot)") !=-1) { return("SE Spider (Omni-Explorer)"); } else if (ua.indexOf("onetszukaj)") !=-1) { return("SE Spider (OnetSzukaj)"); // Polish search engine } else if (ua.indexOf("orbiter)") !=-1) { return("SE Spider (Orbiter)"); // SE visits only home pages } else if (ua.indexOf("pagebiteshyperbot") !=-1) { return("SE Spider (PageBites)"); // job openings and resumes } else if (ua.indexOf("pompos") !=-1) { return("SE Spider (DIR.com)"); // French SE } else if (ua.indexOf("psbot") !=-1) { return("SE Spider (PicSearch.com)"); } else if (ua.indexOf("rampybot") !=-1) { return("SE Spider (GiveRAMP.com)"); } else if (ua.indexOf("rufusbot") !=-1) { return("SE Spider (Webaroo)"); } else if (ua.indexOf("sbider") !=-1) { return("SE Spider (sitesell.com)"); } else if (ua.indexOf("scrubby") !=-1) { return("SE Spider (ScrubTheWeb.com)"); } else if (ua.indexOf("searchsight") !=-1) { return("SE Spider (SearchSight.com)"); // SE and dir } else if (ua.indexOf("seekbot") !=-1) { return("SE Spider (seekbot.com)"); // Euro SE } else if (ua.indexOf("semanticdiscovery") !=-1) { return("SE Spider (Semantic Discovery)"); // Used by dirs } else if (ua.indexOf("sensis web crawler") !=-1) { return("SE Spider (Sensis Web Crawler)"); } else if (ua.indexOf("seochat") !=-1) { return("SE Spider (SEO:Bot)"); } else if (ua.indexOf("shim-crawler") !=-1) { // Japanese research-only SE return("SE Spider (Chikayama Taura Lab)"); } else if (ua.indexOf("shopwiki") !=-1) { return("SE Spider (shopwiki.com)"); // SE plus wiki } else if (ua.indexOf("shoula") !=-1) { return("SE Spider (Shoula.com)"); } else if (ua.indexOf("snappreviewbot") !=-1) { return("SE Spider (SnapPreview.com)"); } else if (ua.indexOf("snappy") !=-1) { return("SE Spider (urltrends.com)"); } else if (ua.indexOf("sogou") !=-1) { return("SE Spider (sohu.com)"); // Chinese SE } else if (ua.indexOf("speedy") !=-1) { return("SE Spider (Entireweb.com)"); } else if (ua.indexOf("stackrambler") !=-1) { return("SE Spider (Rambler.ru)"); // Russia SE } else if (ua.indexOf("synoobot") !=-1) { return("SE Spider (Synoo.de)"); // German SE } else if (ua.indexOf("teoma") !=-1) { return("SE Spider (Ask.com)"); } else if (ua.indexOf("thumbnail.cz robot") !=-1) { return("SE Spider (Thumbnail.cz)"); } else if (ua.indexOf("updated/") !=-1) { return("SE Spider (updated.com)"); } else if (ua.indexOf("voilabot") !=-1) { return("SE Spider (viola.com)"); // } else if (ua.indexOf("voyager/") !=-1) { return("SE Spider (Kosmix)"); } else if (ua.indexOf("webcollage") !=-1) { return("SE Spider (Webcollage)"); } else if (ua.indexOf("websquash") !=-1) { return("SE Spider (Websquash)"); } else if ((ua.indexOf("wf84") !=-1) || (ua.indexOf("ibm.com") !=-1)) { // research project return("SE Spider (WebFountain)"); } else if (ua.indexOf("wofindeich") !=-1) { return("SE Spider (Wofindeich)"); // Swiss SE } else if (ua.indexOf("yahoo! slurp china") !=-1) { return("SE Spider (Yahoo! Slurp China)"); } else if (ua.indexOf("yahoo! slurp") !=-1) { return("SE Spider (Yahoo! Slurp)"); } else if (ua.indexOf("zao/") !=-1) { return("SE Spider (Kototoi.org)"); // Japanese SE } else if (ua.indexOf("zealbot") !=-1) { return("SE Spider (LookSmart)"); } else if (ua.indexOf("zyborg") !=-1) { return("SE Spider (LookSmart - Wise Nut)"); /* * on Mobiles */ } else if (ua.indexOf("maemo browser") !=-1) { // ua may also have opera or firefox return("Mobile Browser (Maemo)"); } else if (ua.indexOf("opera mini") !=-1) { return("Mobile Browser (Opera Mini)"); } else if ((ua.indexOf("opera ") !=-1) && ((ua.indexOf("midp-") !=-1) || (ua.indexOf("midp;") !=-1) || (ua.indexOf("nokia") !=-1) || (ua.indexOf("symbian") !=-1) || (ua.indexOf("palmos") !=-1))) { return("Mobile Browser (Opera)"); } else if (ua.indexOf("blazer") !=-1) { return("Mobile Browser (Blazer - NetFront)"); } else if (ua.indexOf("netfront") !=-1) { return("Mobile Browser (NetFront)"); } else if (ua.indexOf("iemobile") !=-1) { return("Mobile Browser (IE - Mobile)"); } else if (ua.indexOf("android") !=-1) { return("Mobile Browser (Android)"); } else if ((ua.indexOf("safari") !=-1) && (ua.indexOf("symbianos") !=-1)) { return("Mobile Browser (Safari - Mobile)"); } else if ((ua.indexOf("safari") !=-1) && ((ua.indexOf("iphone") !=-1) || (ua.indexOf("ipad") !=-1) || (ua.indexOf("ipod") !=-1)) ) { return("Mobile Browser (Safari - Mobile)"); } else if (ua.indexOf("mobile safari") !=-1) { return("Mobile Browser (Safari - Mobile)"); } else if (ua.indexOf("plucker/") !=-1) { return("Mobile (Plucker)"); } else if (ua.indexOf("up.browser") !=-1) { return("Mobile Browser (OpenWave)"); } else if (ua.indexOf("wm5 pie") !=-1) { // IE for Windows Mobile 5 return("Mobile Browser (Pocket Internet Explorer)"); } else if (ua.indexOf("xiino") !=-1) { return("Mobile Browser (Xiinu)"); /* * Old/failed */ } else if (ua.indexOf("acorn browse") !=-1) { return("Acorn Browse"); // Acorn RISC OS browser } else if (ua.indexOf("amiga-aweb") !=-1) { return("Amiga AWeb"); // Amiga browser } else if (ua.indexOf("amigavoyager") !=-1) { return("Amiga Voyager"); // Amiga browser } else if (ua.indexOf("contiki") !=-1) { return("Contiki"); // for Commodore 64 } else if (ua.indexOf("ibrowse") !=-1) { return("IBrowse"); // for Amiga and Pegasos } else if (ua.indexOf("netpositive") !=-1) { return("NetPositive"); // for BeOS } else if (ua.indexOf("netsurf") !=-1) { // originally for Acorn RISC, now for others also return("NetSurf"); } else if (ua.indexOf("oregano") !=-1) { return("Oregano"); // for Acorn RISC OS } else if (ua.indexOf("xchaos_arachne") !=-1) { return("Arachne"); // DOS browser /* * Pioneer/technology demonstrator/rare/unusual */ } else if (ua.indexOf("amaya") !=-1) { return("Amaya"); // W3C's browser } else if (ua.indexOf("browsex") !=-1) { // non-Gecko browser written with C and Tcl/Tk return("BrowseX"); } else if (ua.indexOf("charon") !=-1) { return("Plan 9 (Charon)"); // from Bell Labs } else if (ua.indexOf("dillo/") !=-1) { return("Dillo"); // Unix/Linux browser written with GTK } else if (ua.indexOf("edbrowse") !=-1) { return("text browser (edbrowse)"); // for visually impaired } else if (ua.indexOf("elinks/") !=-1) { return("text browser (Elinks)"); // for visualy impaired } else if (ua.indexOf("emacs-w3") !=-1) { return("Emacs/W3"); // for emacs users } else if (ua.indexOf("lynx") !=-1) { return("text browser (Lynx)"); } else if ((ua.indexOf("mosaic ") !=-1) || (ua.indexOf("mosaic/") !=-1)) { return("Mosaic"); // base for IE } else if (ua.indexOf("mothra/") !=-1) { return("Plan 9 (Mothra)"); // from Bell Labs } else if (ua.indexOf("retawq") !=-1) { return("text browser (retawq)"); // for unix } else if (ua.indexOf("offbyone;") !=-1) { return("Webster Pro (OffByOne)"); // ActiveX (Browser) } else if (ua.indexOf("w3clinemode") !=-1) { // second browser, after NeXT return("text browser (W3C Line Mode)"); } else if (ua.indexOf("wget/") !=-1) { return("text browser (Wget)"); // GNU downloading } else if (ua.indexOf("w3m/") !=-1) { return("text browser (w3m)"); // renders HTML for emacs /* * Apps */ } else if (ua.indexOf("bimbot") !=-1) { return("App (Bimbot)"); // Unknown } else if (ua.indexOf("bloglines") !=-1) { return("App (Bloglines)"); // Unknown } else if (ua.indexOf("bsalsa") !=-1) { return("App (BSalsa)"); // Embedded browser component } else if (ua.indexOf("cse html validator") !=-1) { return("App (HTMLValidator.com"); } else if (ua.indexOf("csscheck") !=-1) { return("App (HTMLHelp.com"); } else if (ua.indexOf("cynthia ") !=-1) { return("App (HiSoftware.com"); // Accessibility check } else if (ua.indexOf("feedfetcher-google") !=-1) { return("App (Google Reader)"); } else if (ua.indexOf("diamondbot") !=-1) { return("App (Gator)"); // GATOR!!! (spyware); Blacklisted } else if (ua.indexOf("gaisbot") !=-1) { return("App (Gaisbot)"); // Taiwan ed research project } else if (ua.indexOf("gsitecrawler") !=-1) { return("App (gsitecrawler.com"); // Generates sitemaps } else if (ua.indexOf("htmlparser") !=-1) { return("App (HTML Parser Java library"); } else if (ua.indexOf("irlbot") !=-1) { return("App (IRL Crawler)"); // American ed research project } else if (ua.indexOf("java/") !=-1) { return("App (Java)"); } else if (ua.indexOf("link valet online") !=-1) { return("App (HTMLHelp.com)"); // Link checker } else if (ua.indexOf("linksmanager.com") !=-1) { return("App (LinksManager.com)"); // Link checker } else if (ua.indexOf("mojoo robot") !=-1) { return("App (Mojoo.com)"); // Link checker for dir } else if (ua.indexOf("online link validator") !=-1) { return("App (dead-links.com)"); // Link checker } else if (ua.indexOf("rel link checker lite") !=-1) { return("App (REL Link Checker)"); // Link checker } else if (ua.indexOf("vivante link checker") !=-1) { return("App (Vivante.com)"); // Link checker } else if (ua.indexOf("mojoo robot") !=-1) { return("App (Mojoo.com)"); // Link checker for dir } else if (ua.indexOf("lmspider") !=-1) { return("App (Nuance.com)"); } else if (ua.indexOf("lwp-trivial") !=-1) { return("App (lwp simple Perl module)"); } else if (ua.indexOf("libwww-perl/") !=-1) { return("App (Perl)"); } else if (ua.indexOf("lmspider") !=-1) { return("App (Nuance.com)"); } else if (ua.indexOf("linkwalker") !=-1) { return("App (LinkWalker)"); } else if (ua.indexOf("mvaclient") !=-1) { return("App (Chungwa)"); // Blacklisted by SORBS.net } else if (ua.indexOf("netresearchserver") !=-1) { return("App (LoopImprovements.com)"); } else if (ua.indexOf("ng-search") !=-1) { return("App (NG-Search.com)"); } else if (ua.indexOf("nicebot") !=-1) { return("App (nicebot)"); } else if (ua.indexOf(" obot)") !=-1) { return("App (Cobion)"); // Checks copyright infringement } else if ((ua.indexOf("offline explorer") !=-1) || (ua.indexOf("web downloader") !=-1)) { return("App (Offline Explorer)"); } else if (ua.indexOf(" oegp)") !=-1) { return("App (Duetsche Telekom)"); // Blacklisted } else if (ua.indexOf("p3p validator") !=-1) { // Generate p3p policy free at+ // http://www.vsubhash.com/writeups/privacy_policy_gen.asp return("App (W3C P3P Validator"); } else if (ua.indexOf("polybot") !=-1) { // ed research project; distributed web crawler return("App (Polybot)"); } else if (ua.indexOf("pycurl") !=-1) { return("App (PycURL)"); // Python interface to cURL } else if (ua.indexOf("python-urlib") !=-1) { return("App (Phyton)"); // } else if (ua.indexOf("sandcrawler") !=-1) { return("App (SandCrawler)"); // Unknown MS bot } else if (ua.indexOf("snoopy") !=-1) { return("App (Snoopy PHP class)"); // Unknown MS bot } else if (ua.indexOf("superbot") !=-1) { return("App (Sparkleware)"); // Offline browser } else if (ua.indexOf("surveybot") !=-1) { return("App (Whois Source SE)"); // Whois Source SE } else if (ua.indexOf("thunderbird/") !=-1) { return("App (Thunderbird)"); // Email client } else if (ua.indexOf("turnitinbot") !=-1) { return("App (turnitin.com)"); } else if (ua.indexOf("w3c-checklink") !=-1) { return("App (W3C Link Checker)"); // Link checker } else if (ua.indexOf("w3c_css_validator") !=-1) { return("App (W3C CSS Validator)"); } else if (ua.indexOf("w3c_validator") !=-1) { return("App (W3C Validator)"); // Markup validation } else if (ua.indexOf("wdg_validator") !=-1) { return("App (HTMLHelp.com)"); // Markup validation } else if (ua.indexOf("webcapture") !=-1) { return("App (Adobe Acrobat)"); } else if (ua.indexOf("webcopier") !=-1) { return("App (Web Copier)"); } else if (ua.indexOf("webzip") !=-1) { return("App (WebZIP)"); } else if (ua.indexOf("wortschatz.uni-leipzig.de/findlinks/)") !=-1) { return("App (Findlinks)"); // German ed research project } else if ((ua.indexOf("xenu_link_sleuth") !=-1) || (ua.indexOf("xenu link sleuth") !=-1)) { return("App (Xenu Link Analyser)"); // broken links analyser } else if (ua.indexOf("yacy") !=-1) { return("App (YaCy)"); // P2P web search /* * Spoofers */ } else if ((ua.indexOf("opera ") !=-1) || (ua.indexOf("opera/") !=-1)){ return("Opera"); // if spoofing other browsers /* * Mozillaz */ } else if ((ua.indexOf("aol/") !=-1) && (ua.indexOf("msie") == -1)) { return("Mozilla (AOL)"); // AOL browser } else if (ua.indexOf("beonex") !=-1) { return("Mozilla (Beonex)"); } else if ( (ua.indexOf("mozilla") !=-1) && ( (ua.indexOf("bonecho/") !=-1) || (ua.indexOf("deer park") !=-1) || (ua.indexOf("granparadiso") !=-1) || (ua.indexOf("minefield/") !=-1)) || (ua.indexOf("shiretoko/") !=-1) ) { return("Mozilla (test build)"); } else if ((ua.indexOf("camino") !=-1) || (ua.indexOf("chimera") !=-1)) { // Mozilla's browser for Mac OS return("Mozilla (Camino)"); } else if ((ua.indexOf("epiphany") !=-1) && (ua.indexOf("firefox") !=-1)) { // for Gnome desktop; Firefox codebase return("Mozilla (Epiphany)"); } else if (ua.indexOf("flock/") !=-1) { return("Mozilla (Flock)"); } else if (ua.indexOf("galeon") !=-1) { return("Mozilla (Galeon)"); // for Gnome desktop } else if (ua.indexOf("iceweasel") !=-1) { // Part of GNU version of Mozilla suite return("Mozilla (Iceweasel)"); } else if (ua.indexOf("firebird") !=-1) { // Firebird gave way to Firebird return("Mozilla (Firebird)"); } else if (ua.indexOf("k-ninja") !=-1) { // K-Meleo-based; more web page; less toolbar buttons return("Mozilla (K-Ninja)"); } else if (ua.indexOf("k-meleon") !=-1) { // for Windows; lightweight; // no-installation reqd seen in Ubuntu live CD return("Mozilla (K-Meleon)"); } else if (ua.indexOf("minimo") !=-1) { // Mozilla for mobile return("Mobile Browser (Minimo - Mozilla)"); } else if (ua.indexOf("multizilla") !=-1) { return("Mozilla (MultiZilla)"); } else if (ua.indexOf("phoenix") !=-1) { return("Mozilla (Phoenix)"); } else if ((ua.indexOf("firefox") !=-1) && (ua.indexOf("navigator") !=-1)) { // Netscape 9.x or later; built on Firefox codebase return("Mozilla (Netscape)"); } else if (ua.indexOf("iceape") !=-1) { return("Mozilla (IceApe)"); // Unbranded SeaMonkey } else if (ua.indexOf("seamonkey") !=-1) { // industrial-strength all-in-one package return("Mozilla (SeaMonkey)"); } else if (ua.indexOf("songbird") !=-1) { return("Mozilla (Songbird)"); // optimized for moosic } else if (ua.indexOf("sylera") !=-1) { // Japanese browser with Mozilla base; // Gecko-based version probably available return("Mozilla (Sylera)"); } else if (ua.indexOf("firefox") != -1) { // if not anything else, it is the fireferret return("Mozilla (Firefox)"); } else if (ua.indexOf("netscape") !=-1) { return("Netscape"); // Netscape 6.x to 8.x } else if (ua.indexOf("epiphany") !=-1) { return("Epiphany"); // for Gnome desktop; own codebase } else if (ua.indexOf("omniweb") !=-1) { return("OmniWeb"); // own codebase /* * Konqueror - KHTML */ } else if (ua.indexOf("chromeframe") !=-1) { return("Konqueror (Chrome - IE Frame)"); } else if ((ua.indexOf("chrome/") !=-1) && (ua.indexOf("khtml") !=-1)) { return("Konqueror (Google Chrome)"); // Google Chrome } else if (ua.indexOf("cheshire/") !=-1) { // AOL alpha stage browser for Mac return("Konqueror (Cheshire)"); } else if (ua.indexOf("shiira") !=-1) { return("Konqueror (Shiira Safari)"); } else if (ua.indexOf("sunrise/") !=-1) { return("Konqueror (Sunrise)"); } else if ((ua.indexOf("konqueror") !=-1) && (ua.indexOf("microsoft windows") !=-1)) { return("Konqueror (Beta for Windows)"); // KDE browser } else if (ua.indexOf("konqueror") !=-1) { return("Konqueror"); // KDE browser } else if ((ua.indexOf("omniweb") !=-1) && (ua.indexOf("khtml") !=-1)) { return("Konqueror (OmniWeb)"); // KHTML codebase /* * Ayee */ } else if (ua.indexOf("webtv") !=-1) { return("IE (WebTV)"); // WebTV browser } else if ((ua.indexOf(" aol ") !=-1) || (ua.indexOf("america online") !=-1)) { return("IE (AOL)"); // AOL browser } else if (ua.indexOf("avant browser") !=-1) { // Tabbed browser with IE engine return("IE (Avant Browser)"); } else if (ua.indexOf("crazy browser;") !=-1) { // Tabbed browser with IE engine return("IE (Crazy Browser)"); } else if (ua.indexOf("enigma browser") !=-1) { return("IE (Enigma Browser)"); } else if (ua.indexOf("maxthon;") !=-1) { // Tabbed browser with IE engine return("IE (Maxthon)"); } else if ((ua.indexOf("msie") !=-1) && (ua.indexOf("myie") !=-1)) { // Tabbed browser with IE engine return("IE (MyIE)"); } else if (ua.indexOf("msie 10") !=-1) { return("IE (IE10)"); } else if (ua.indexOf("msie 9") !=-1) { return("IE (IE9)"); } else if (ua.indexOf("msie 8") !=-1) { return("IE (IE8)"); } else if (ua.indexOf("msie 7") !=-1) { return("IE (IE7)"); } else if (ua.indexOf("msie 6") !=-1) { return("IE (IE6)"); } else if (ua.indexOf("msie 5.5") !=-1) { return("IE (IE 5.5)"); } else if (ua.indexOf("msie 5") !=-1) { return("IE (IE 5.x)"); } else if (ua.indexOf("msie 4") !=-1) { return("IE (IE4)"); } else if (ua.indexOf("msie") !=-1) { return("IE"); // 3 or older /* * Last chance */ } else if (ua.indexOf("safari") !=-1) { return("Konqueror (Safari)"); // finally } else if (ua.indexOf(" sun") !=-1) { return("HotJava"); // it could be } else if ((ua.indexOf("curl") !=-1) || (ua.indexOf("libcurl") !=-1)) { return("Bot (cURL)"); // called from command-line } else if (ua.indexOf("icab") !=-1) { return("iCab"); // for all Macs } else if ((ua.indexOf("midp-") !=-1) || (ua.indexOf("midp;") !=-1)) { return("Mobile Browser (?)"); // possibly } else if ( (ua.indexOf("mozilla/4.8") !=-1) || (ua.indexOf("mozilla/4.7") !=-1) || (ua.indexOf("mozilla/4.6") !=-1) || (ua.indexOf("mozilla/4.5") !=-1) || (ua.indexOf("mozilla/4.08") !=-1) || (ua.indexOf("mozilla/4.07") !=-1) || (ua.indexOf("mozilla/4.06") !=-1) || (ua.indexOf("mozilla/4.05") !=-1) || (ua.indexOf("mozilla/4.04") !=-1) || (ua.indexOf("mozilla/4.03") !=-1) || (ua.indexOf("mozilla/4.01") !=-1) || (ua.indexOf("mozilla/3.02") !=-1) || (ua.indexOf("mozilla/3.01") !=-1) || (ua.indexOf("mozilla/3.0") !=-1) ) { return("Netscape"); } else if (ua.indexOf("links (") !=-1) { return("text browser (Links)"); // possibly } else if (ua.indexOf("mozilla") !=-1) { return("Mozilla (compatible?)"); } else { return("Unknown"); } } /* * Library: Really Ultimate Client-Sniffer JavaScript * * Function: Detects operating systems. * * Usage: Pass lowercase'd useragent to the function * ~ navigator.userAgent.toLowerCase() * * Author: V. Subhash * Created: 29 September 2011 * Updated: 11 May 2013 * * Thanks: useragentstrings.com and zytrax.com * License: Share and share alike like GPL * * Website: http://www.vsubhash.com */ function get_OsName(ua) { if (get_BrowserName(ua).indexOf("SE Spider (") != -1) { return("not applicable"); /* * Mobiles */ } else if (ua.indexOf("android 4.1") !=-1) { return("Mobile Phone (Android 4.1.x - Jellybean)"); } else if (ua.indexOf("android 4.0") !=-1) { return("Mobile Phone (Android 4.0.x - ICS)"); } else if (ua.indexOf("android 3") !=-1) { return("Mobile Phone (Android 3.x - Honeycomb)"); } else if (ua.indexOf("android 2.3") !=-1) { return("Mobile Phone (Android 2.3.x - Gingerbread)"); } else if (ua.indexOf("android 2.2") !=-1) { return("Mobile Phone (Android 2.2.x - Froyo)"); } else if (ua.indexOf("android 2.1") !=-1) { return("Mobile Phone (Android 2.1.x - Eclair)"); } else if (ua.indexOf("android 1.6") !=-1) { return("Mobile Phone (Android 1.6.x - Donut)"); } else if (ua.indexOf("android 1.5") !=-1) { return("Mobile Phone (Android 1.5.x - Cupcake)"); } else if (ua.indexOf("android") !=-1) { return("Mobile Phone (Android)"); } else if (ua.indexOf("ipod") != -1) { return("Internet Device (Apple iPod)"); } else if (ua.indexOf("ipad") != -1) { return("Tablet (Apple iPad)"); } else if (ua.indexOf("n770") != -1) { return("Tablet (Nokia Internet Tablet)"); } else if (ua.indexOf("webtv") !=-1) { return("Internet Device (WebTV)"); } else if (ua.indexOf("rim playbook") !=-1) { return("Tablet (RIM Playbook)"); } else if (ua.indexOf("blackberry") !=-1) { return("Mobile Phone (Blackberry)"); } else if (ua.indexOf("danger hiptop") !=-1) { return("Mobile Phone (T-Mobile SideKick)"); } else if ((ua.indexOf("hp ipaq") !=-1) || (ua.indexOf("hpipaq") !=-1)) { return("Mobile Phone (HP iPaQ)"); } else if (ua.indexOf("htc desire") !=-1) { return("Mobile Phone (HTC Desire)"); } else if (ua.indexOf("htc_") !=-1) { return("Mobile Phone (HTC)"); } else if (ua.indexOf("iphone") !=-1) { return("Mobile Phone (iPhone)"); } else if ((ua.indexOf("motoq9c") != -1) || (ua.indexOf("motorola") != -1)) { return("Mobile Phone (Motorola)"); } else if ((ua.indexOf("nokia") !=-1) && (ua.indexOf("symbian") != -1)) { return("Mobile Phone (Nokia - Symbian OS)"); } else if (ua.indexOf("nokia") != -1) { return("Mobile Phone (Nokia)"); } else if (ua.indexOf("o2 xda") != -1) { return("Mobile Phone (O2)"); } else if (ua.indexOf("symbian") != -1) { return("Mobile Phone (Symbian OS)"); } else if ((ua.indexOf("palmos") !=-1) || (ua.indexOf("palmsource") !=-1) || (ua.indexOf("/palm") !=-1)) { return("Mobile Phone (Palm OS)"); } else if (ua.indexOf("sagem-") !=-1) { return("Mobile Phone (Sagem)"); } else if ((ua.indexOf("samsung") !=-1) || (ua.indexOf("sec-sgh") !=-1)) { return("Mobile Phone (Samsung)"); } else if (ua.indexOf("sharp-") !=-1) { return("Mobile Phone (Sharp)"); } else if (ua.indexOf("sonyericsson") !=-1) { return("Mobile Phone (Sony Ericsson)"); } else if (ua.indexOf("wm5 pie") !=-1) { return("Mobile Phone (Windows Mobile 5)"); /* * Gaming consoles */ } else if (ua.indexOf("playstation portable") !=-1) { return("Game Console (PlayStation Portable)"); } else if (ua.indexOf("playstation 3") !=-1) { return("Game Console (PlayStation 3)"); } else if ((ua.indexOf("nintendo wii") !=-1) || (ua.indexOf("wii libnup") !=-1)) { return("Game Console (Nintendo Wii)"); } else if (ua.indexOf("nitro)") !=-1) { return("Game Console (Nintendo DS)"); /* * Old/failed OSes */ } if (ua.indexOf("morphos") !=-1) { return("Amiga/Morph OS"); } else if (ua.indexOf("amiga") !=-1) { return("Amiga"); } else if ((ua.indexOf("acorn ") !=-1) || (ua.indexOf("acorn-") !=-1) || (ua.indexOf("risc os") !=-1)) { return("Acorn RISC OS"); } else if (ua.indexOf("commodore 64") !=-1) { return("Commodore 64"); } else if ((ua.indexOf("beos;") !=-1) || (ua.indexOf("beos ") !=-1) || (ua.indexOf("beos)") !=-1) || (ua.indexOf("netpositive") !=-1)) { return("BeOS"); } else if (ua.indexOf(" os/2 ") !=-1) { return("OS/2 Warp"); } else if (ua.indexOf("openvms") !=-1) { return("OpenVMS"); /* * Unusual */ } else if (ua.indexOf("cygwin") !=-1) { return("CYGWIN"); /* * Unices */ } else if (ua.indexOf("aix ") !=-1) { return("Unix (IBM Aix)"); } else if ((ua.indexOf("net bsd") !=-1) || (ua.indexOf("netbsd")) != -1) { return("Unix (BSD)"); } else if (ua.indexOf("freebsd") !=-1) { return("Unix (Free BSD)"); } else if (ua.indexOf("hp-ux") !=-1) { return("Unix (HP-UX)"); } else if (ua.indexOf("irix ") !=-1) { return("Unix (IRIX)"); } else if (ua.indexOf("openbsd") !=-1) { return("Unix (Open BSD)"); } else if (ua.indexOf("sunos") !=-1) { return("Unix (Sun Solaris)"); /* * Macs */ } else if ((ua.indexOf("macintosh") !=-1) || (ua.indexOf("mac os x") !=-1) || (ua.indexOf("mac_powerpc") !=-1) || (ua.indexOf("powerpc-apple") !=-1) || (ua.indexOf("mac_ppc") !=-1) || (ua.indexOf("darwin") !=-1)) { return("Mac"); /* * Windows */ } else if ((ua.indexOf("win95") !=-1) || (ua.indexOf("windows 95") !=-1)) { return("Windows (95)"); } else if ((ua.indexOf("win 9x 4.90") !=-1) || (ua.indexOf("windows me") !=-1)) { return("Windows (Me)"); } else if ((ua.indexOf("windows 2000") !=-1) || (ua.indexOf("windows nt 5.0") !=-1)) { return("Windows (2000)"); } else if ((ua.indexOf("windows nt 5.1") !=-1) || (ua.indexOf("windows xp") !=-1)){ return("Windows (XP)"); } else if (ua.indexOf("windows nt 5.2 x64") !=-1) { return("Windows (XP 64-bit)"); } else if (ua.indexOf("windows nt 5.2") !=-1) { return("Windows (Server 2003)"); } else if (ua.indexOf("windows nt 6.0") !=-1) { return("Windows (Vista)"); } else if (ua.indexOf("windows nt 6.1") !=-1) { return("Windows (7)"); } else if (ua.indexOf("windows nt 6.2") !=-1) { return("Windows (8)"); } else if ((ua.indexOf("windows nt 4.0") !=-1) || (ua.indexOf("winnt") !=-1) || (ua.indexOf("windows nt") !=-1)) { return("Windows (NT)"); } else if ((ua.indexOf("windows 98") !=-1) || (ua.indexOf("win98") !=-1)) { return("Windows (98)"); } else if (ua.indexOf("windows 3.1") !=-1) { return("Windows (3.1)"); } else if (ua.indexOf("microsoft windows") !=-1) { return("Windows (?)"); // Konqueror /* * Linices */ } else if (ua.indexOf("xandros") !=-1) { return("Linux (Xandros)"); } else if (ua.indexOf("splashtop") !=-1) { return("Linux (DeviceVM Splashtop)"); } else if (ua.indexOf("slitaz gnu") !=-1) { return("Linux (SliTaz GNU)"); } else if (ua.indexOf("gentoo") !=-1) { return("Linux (Gentoo)"); } else if (ua.indexOf("mepis") !=-1) { return("Linux (Mepis)"); } else if (ua.indexOf("mandriva") !=-1) { return("Linux (Mandriva)"); } else if ((ua.indexOf("suse/") !=-1) || (ua.indexOf(" suse") !=-1)) { return("Linux (SUSE)"); } else if (ua.indexOf("centos") !=-1) { return("Linux (Cent OS)"); } else if (ua.indexOf("red hat") !=-1) { return("Linux (Red Hat)"); } else if (ua.indexOf("pclinuxos") !=-1) { return("Linux (PCLinuxOS)"); // Derived from Mandriva } else if (ua.indexOf("linux mint") !=-1) { return("Linux (Linux Mint)"); // Derived from Ubuntu } else if (ua.indexOf("kubuntu") !=-1) { return("Linux (Kubuntu)"); // Derived from Ubuntu } else if (ua.indexOf("ubuntu") !=-1) { return("Linux (Ubuntu)"); // Derived from Debian } else if (ua.indexOf("debian") !=-1) { return("Linux (Debian)"); } else if (ua.indexOf("fedora") !=-1) { return("Linux (Fedora)"); /* * Known unknowns - OS guessed from browser */ } else if ((ua.indexOf("dillo/") !=-1) || (ua.indexOf("edbrowse") !=-1)) { return("Unknown (Unix/Linux)"); } else if (ua.indexOf("xchaos_arachne") !=-1) { // arachne running on DOS return("DOS (?)"); } else if ((ua.indexOf("browsex") !=-1) && (ua.indexOf("windows") !=-1)) { return("Windows (?)"); // browseX running on Windows } else if ((ua.indexOf("browsex") !=-1) && (ua.indexOf("x11") !=-1)) { // browseX running on Linux return("Unknown (Unix/Linux)"); /* * Last chance */ } else if (ua.indexOf("linux") !=-1) { return("Linux (?)"); } else if (ua.indexOf("x11") !=-1) { return("Unknown (Unix/Linux)"); } else if (ua.indexOf("mot-") !=-1) { return("Mobile Phone (Motorola)"); } else if (ua.indexOf("windows ce") !=-1) { return("Mobile Phone (Windows WinCE)"); } else if (ua.indexOf("windows") !=-1) { return("Windows (?)"); // Mosaic } else if ((ua.indexOf("mobile phone") !=-1) || (ua.indexOf("midp-") !=-1) || (ua.indexOf("midp;") !=-1)) { return("Mobile Phone (?)"); /* * Unknown */ } else { return("Unknown"); } }
This update to my client-sniffer javascript was made possible by the information provided by www.zytrax.com and useragentstrings.com.