测试时各个浏览器版本
IE: 11.953.14393.0
Edge: Microsoft Edge 38.14393.0.0;Microsoft EdgeHTML 14.14393
Chrome: 57.0.2987.133 (64-bit)
FireFox: 52.0.1 (32 位)
360极速浏览器: 版本号:8.7.0.306;内核版本号:50.0.2661.102
360安全浏览器: 版本号:8.1.1.400;内核版本号:45.0.2454.101
程序源码
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">JS获取浏览器类型和版本信息functionbro(){varis360 =false;varisIE =false;varisFirefox =false;varisChrome =false;varisEdge =false;varbroName ='Runing';varstr ='';varstrStart =0;varstrStop =0;vararr =newArray();vartemp ='';varuserAgent =window.navigator.userAgent;//包含以下属性中所有或一部分的字符串:appCodeName,appName,appVersion,language,platform/*alert(userAgent);*///FireFoxif(userAgent.indexOf('Firefox') !=-1) {isFireFox =true;/*broName = 'FireFox浏览器';*/strStart = userAgent.indexOf('Firefox');temp = userAgent.substring(strStart);broName = temp.replace('/','版本号')}//Edgeif(userAgent.indexOf('Edge') !=-1) {isEdge =true;/*broName = 'Edge浏览器';*/strStart = userAgent.indexOf('Edge');temp = userAgent.substring(strStart);broName = temp.replace('/','版本号');}//IE浏览器if(userAgent.indexOf('NET') !=-1&& userAgent.indexOf("rv") !=-1) {isIE =true;/*broName = 'IE浏览器'; */strStart = userAgent.indexOf('rv');strStop = userAgent.indexOf(')');temp = userAgent.substring(strStart, strStop);broName = temp.replace('rv','IE').replace(':','版本号');}//360极速模式可以区分360安全浏览器和360极速浏览器if(userAgent.indexOf('WOW') !=-1&& userAgent.indexOf("NET")
JavaScript获取浏览器版本信息
获取浏览器详细信息
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">New Document/******************************************下为浏览器信息************************************************///获取浏览器相关信息function allinfo() {var appName = navigator.appName; //浏览器的正式名称var appVersion = navigator.appVersion; //浏览器的版本号var cookieEnabled = navigator.cookieEnabled; // 返回用户浏览器是否启用了cookievar cpuClass = navigator.cpuClass; //返回用户计算机的cpu的型号,通常intel芯片返回"x86"(火狐没有)var mimeType = navigator.mimeTypes; // 浏览器支持的所有MIME类型的数组var platform = navigator.platform; // 浏览器正在运行的操作系统平台,包括Win16(windows3.x) // Win32(windows98,Me,NT,2000,xp),Mac68K(Macintosh 680x0)// 和MacPPC(Macintosh PowerPC)var plugins = navigator.plugins; // 安装在浏览器上的所有插件的数组var userLanguage = navigator.userLanguage; // 用户在自己的操作系统上设置的语言(火狐没有)var userAgent = navigator.userAgent; //包含以下属性中所有或一部分的字符串:appCodeName,appName,appVersion,language,platformvar systemLanguage = navigator.systemLanguage; // 用户操作系统支持的默认语言(火狐没有)//directorvar appCodeName = navigator.appCodeName; //与浏览器相关的内部代码名var appMinorVersion = navigator.appMinorVersion; //辅版本号(通常应用于浏览器的补丁或服务包)var language = navigator.language; //浏览器支持的语言 (IE没有)var onLine = navigator.onLine; //返回浏览器是否处于在线模式(IE4以上版本)var opsProfile = navigator.opsProfile; // 未定义 (IE、火狐没有)var oscpu = navigator.oscpu; //浏览器正在运行的操作系统,其中可能有CPU的信息(IE没有)var product = navigator.product; // 浏览器的产品名(IE没有)var productSub = navigator.productSub; //关于浏览器更多信息(IE没有)var securityPolicy = navigator.securityPolicy; // 浏览器支持的加密类型(IE没有)var userProfile = navigator.userProfile; // 返回一个UserProfile对象,它存储用户的个人信息(火狐没有)var vender = navigator.vender; // 浏览器厂商名称(IE、火狐没有)var vendorSub = navigator.vendorSub; // 关于浏览器厂商更多的信息var webkitPersistentStorage = navigator.webkitPersistentStorage;var info = "";var type = "";if (isIe()) {type = "IE浏览器";} else if (isFireFox()) {type = "火狐浏览器";}info += "IE特有属性:" + navigator.msManipulationViewsEnabled + "";info += "浏览器类型:" + type + "";info += "weizhi :" + webkitPersistentStorage + "";info += "浏览器属性信息:" + userAgent + "";info += "浏览器的正式名称:" + appName + "";info += "浏览器的版本号:" + appVersion + "";info += "浏览器相关的内部代码名:" + appCodeName + "";info += "浏览器相关的辅代码号:" + appMinorVersion + "";info += "浏览器支持的语言IE没有):" + language + "";info += "浏览器是否处于在线模式:" + onLine + "";info += "浏览器的产品名(IE没有):" + product + "";info += "浏览器更多信息:" + productSub + "";info += "浏览器厂商名称:" + vender + "";info += "浏览器厂商更多信息:" + vendorSub + "";info += "浏览器的是否启用了cookie:" + cookieEnabled + "";info += "cpu等级:" + cpuClass + "";info += "浏览器的MIME类型:" + mimeType.length + "";info += "系统平台:" + platform + "";info += "安装的插件:" + plugins + "";info += "插件的数量:" + plugins.length + "";info += "插件的名称:" + getPluginName() + "";info += "用户设置的操作系统语言:" + userLanguage + "";info += "操作系统支持的默认语言:" + systemLanguage + "";info += "Director:" + checkePlugs("Director") + "";info += "javaEnabled:" + navigator.javaEnabled() + "";info += "是否有quickTime:" + checkePlugs("QuickTime") + "";info += "flash插件情况:" + checkePlugs('Shockwave Flash') + "";info += "是否有MediaPlayer:" + checkePlugs("MediaPlayer") + "";info += "是否有realPlayer:" + checkePlugs("RealPlayer") + "";info += "屏幕分辨率高度:" + window.screen.height + "";info += "屏幕分辨率宽度:" + window.screen.width + "";info += "颜色质量:" + window.screen.colorDepth + "位";info += "像素:" + window.screen.deviceXDPI + "像素/英寸";info += "字体是否平滑:" + window.screen.fontSmoothingEnabled + "";//info += "规定浏览器是否启用数据污点:" + navigator.taintEnabled() + "";info += "";document.getElementById("elInfo").innerHTML = info;return info; }//获取插件所有的名称function getPluginName() {var info = "";var plugins = navigator.plugins;if (plugins.length > 0) {for (i = 0; i0) {for (i = 0; i= 0) {f = navigator.plugins[i].description.split(pluginname)[1];return f;break;}}}return false;}//判断是否IEfunction isIe() {var i = navigator.userAgent.toLowerCase().indexOf("msie");return i >= 0;}//判断是否firefoxfunction isFireFox() {var i = navigator.userAgent.toLowerCase().indexOf("firefox");return i >= 0;} /******************************************以上为浏览器信息,以下为pc信息************************************************/var locator = new ActiveXObject("WbemScripting.SWbemLocator");var service = locator.ConnectServer(".");function cpuInfo() { //CPU 信息 var properties = service.ExecQuery("SELECT * FROM Win32_Processor");var e = new Enumerator(properties);var info = "";info += "CPU 信息";for (; !e.atEnd(); e.moveNext()) {var p = e.item();info += "CPU序列号:" + p.ProcessorID + "";info += "" + p.Caption + "";info += "CPU编号:" + p.DeviceID + "";info += "CPU型号:" + p.Name + "";info += "CPU状态:" + p.CpuStatus + "";info += "CPU可用性:" + p.Availability + "";info += "CUP Level:" + p.Level + "";info += "主机名称:" + p.SystemName + "";info += "Processor Type:" + p.ProcessorType + "";}info += "";return info;}function softDisk() { //软盘信息 var properties = service.ExecQuery("SELECT * FROM Win32_FloppyDrive");var e = new Enumerator(properties);var info = "";info += "软盘信息";for (; !e.atEnd(); e.moveNext()) {var p = e.item();info += "" + p.Description + "";info += "" + p.DeviceID + "";info += "" + p.Status + "";info += "" + p.Manufacuturer + "";}info += "";return info;}function RomInfo() { //CD-ROM 信息 var properties = service.ExecQuery("SELECT * FROM Win32_CDROMDrive");var e = new Enumerator(properties);var info = "";info += "CD-ROM 信息";for (; !e.atEnd(); e.moveNext()) {var p = e.item();info += "驱动器名称:" + p.Caption + "";info += "描述:" + p.Description + "";info += "盘符:" + p.Drive + "";info += "驱动器状态:" + p.Status + "";info += "是否在使用:" + p.MediaLoaded + "";}info += "";return info;}function keyBoardInfo() { //键盘信息 var properties = service.ExecQuery("SELECT * FROM Win32_Keyboard");var e = new Enumerator(properties);var info = "";info += "键盘信息";for (; !e.atEnd(); e.moveNext()) {var p = e.item();info += "键盘描述:" + p.Description + "";info += "键盘名称:" + p.Name + "";info += "键盘状态:" + p.Status + "";}info += "";return info;}function mainBoard() { //主板信息 var properties = service.ExecQuery("SELECT * FROM Win32_BaseBoard");var e = new Enumerator(properties);var info = "";info += "主板信息";for (; !e.atEnd(); e.moveNext()) {var p = e.item();info += "主板ID:" + p.SerialNumber + "";info += "" + p.HostingBoard + "";info += "制造商:" + p.Manufacturer + "";info += "是否开启:" + p.PoweredOn + "";info += "型号:" + p.Product + "";info += "版本:" + p.Version + "";}info += "";return info;}function disk() { //硬盘序列号 信息var properties = service.ExecQuery("SELECT * FROM Win32_DiskDrive");var e = new Enumerator(properties);var info = "";info += "硬盘信息";for (; !e.atEnd(); e.moveNext()) {var p = e.item();info += "硬盘序列号:" + p.signature + "";}info += "";return info;}//获取Ram信息function raminfo() {var system = new Enumerator(service.ExecQuery("SELECT * FROM Win32_ComputerSystem")).item();var physicMenCap = Math.ceil(system.TotalPhysicalMemory / 1024 / 1024);//内存信息 var memory = new Enumerator(service.ExecQuery("SELECT * FROM Win32_PhysicalMemory"));for (var mem = [], i = 0; !memory.atEnd(); memory.moveNext()) {mem[i++] = {cap: memory.item().Capacity / 1024 / 1024,speed: memory.item().Speed};}var info = "";info += "内存信息";info += "内存总量:" + (mem[0].cap + mem[1].cap) + "M";info += "可用物理内存:" + physicMenCap + "M";info += "";return info;}//获取网络连接信息function ipinfo() {var properties = service.ExecQuery("SELECT * FROM Win32_NetworkAdapterConfiguration Where IPEnabled=TRUE");var e = new Enumerator(properties);var info = "";info += "网络连接信息:";var i = 1;for (; !e.atEnd(); e.moveNext()) {var p = e.item();info += "MAC地址" + i + ":" + p.MACAddress + "";info += "IP地址" + i + ":" + p.IPAddress(0) + "";i++;}info += "";return info;}function pcInfo() { //所有信息var info = cpuInfo();info += disk();info += raminfo();info += mainBoard();info += ipinfo();info += keyBoardInfo();info += RomInfo();info += softDisk();document.getElementById('elInfo').innerHTML = info;return info;}