代码语言
.
CSharp
.
JS
Java
Asp.Net
C
MSSQL
PHP
Css
PLSQL
Python
Shell
EBS
ASP
Perl
ObjC
VB.Net
VBS
MYSQL
GO
Delphi
AS
DB2
Domino
Rails
ActionScript
Scala
代码分类
文件
系统
字符串
数据库
网络相关
图形/GUI
多媒体
算法
游戏
Jquery
Extjs
Android
HTML5
菜单
网页交互
WinForm
控件
企业应用
安全与加密
脚本/批处理
开放平台
其它
【
VB.NET
】
根据User Agent来判定操作系统与浏览器类型
作者:
/ 发布于
2019/11/5
/
1337
<%dim UserAgent1 UserAgent1=""&trim(Request.ServerVariables("HTTP_USER_AGENT"))&"" if UserAgent1="" then UserAgent1="UserAgent Unknown" else UserAgent1=""&UserAgent1&"" end if Function getOS(UserAgent) '下面三种判定,写在一起 if UserAgent="UserAgent Unknown" then :vOs="UserAgent isNull OS Unknown|Other":getOS=vOS:exit Function:end if dim vOS '-------先判定手机系统 if instr(1,UserAgent,"Windows CE",1)>0 then vOs="Windows CE|手机系统" elseif instr(1,UserAgent,"iPhone",1)>0 then vOs="iPhone|手机系统" elseif instr(1,UserAgent,"BlackBerry",1)>0 then vOs="BlackBerry|手机系统" elseif instr(1,UserAgent,"Series60",1)>0 and instr(1,UserAgent,"NOKIA",1)>0 then vOs="Nokia S60|手机系统" elseif instr(1,UserAgent,"NOKIA",1)>0 then vOs="Nokia|手机系统" elseif instr(1,UserAgent,"SymbianOS",1)>0 or instr(1,UserAgent,"Series",1)>0 then vOs="SymbianOS|手机系统" elseif instr(1,UserAgent,"SonyEricsson",1)>0 then vOs="SonyEricsson|手机系统" elseif instr(1,UserAgent,"LG",1)>0 then vOs="LG手机|手机系统" elseif instr(1,UserAgent,"MOT",1)>0 or instr(1,UserAgent,"Motorola",1)>0 then vOs="MOTO手机|手机系统" elseif instr(1,UserAgent,"SEC",1)>0 or instr(1,UserAgent,"SAMSUNG",1)>0 then vOs="三星手机|手机系统" elseif instr(1,UserAgent,"ZTE")>0 then vOs="中兴手机|手机系统" elseif instr(1,UserAgent,"DX",1)>0 or instr(1,UserAgent,"DAXIAN",1)>0 then vOs="大显手机|手机系统" elseif instr(1,UserAgent,"TELSON",1)>0 then vOs="泰信[代工]手机|手机系统" elseif instr(1,UserAgent,"Dopod",1)>0 then vOs="多普达手机|手机系统" elseif instr(1,UserAgent,"PHILIPS",1)>0 then vOs="PHILIPS手机|手机系统" elseif instr(1,UserAgent,"Haier",1)>0 then vOs="海尔手机|手机系统" elseif instr(1,UserAgent,"LENOVO",1)>0 then vOs="联想手机|手机系统" elseif instr(1,UserAgent,"CECT",1)>0 then vOs="CECT手机|手机系统" elseif instr(1,UserAgent,"NEC",1)>0 then vOs="NEC手机|手机系统" elseif instr(1,UserAgent,"Bird",1)>0 then vOs="波导手机|手机系统" elseif instr(1,UserAgent,"DBTEL",1)>0 then vOs="迪比特手机|手机系统" elseif instr(1,UserAgent,"TCL",1)>0 then vOs="TCL手机|手机系统" elseif instr(1,UserAgent,"oppo",1)>0 then vOs="Oppo手机|手机系统" elseif instr(1,UserAgent,"AMOI",1)>0 then vOs="夏新手机|手机系统" elseif instr(1,UserAgent,"Alcatel",1)>0 then vOs="阿尔卡特手机|手机系统" elseif instr(1,UserAgent,"Ericsson",1)>0 then vOs="爱立信手机|手机系统" elseif instr(1,UserAgent,"BenQ",1)>0 then vOs="明基手机|手机系统" elseif instr(1,UserAgent,"KONKA",1)>0 then vOs="康佳手机|手机系统" elseif instr(1,UserAgent,"ChangHong",1)>0 then vOs="长虹手机|手机系统" elseif instr(1,UserAgent,"MALATA",1)>0 then vOs="万利达手机|手机系统" elseif instr(1,UserAgent,"KTOUCH",1)>0 or instr(1,UserAgent,"TIANYU",1)>0 or instr(1,UserAgent,"K-TOUCH",1)>0 then vOs="天语手机|手机系统" '---------------下面2个要在手机中最后判定,最普通的手机了MAUI----------- elseif instr(1,UserAgent,"MAUI",1)>0 then vOs="MTK杂牌手机|手机系统" elseif instr(1,UserAgent,"MIDP",1)>0 or instr(1,UserAgent,"JAVA",1)>0 or instr(1,UserAgent,"J2ME",1)>0 then vOs="Java移动设备|手机系统" else vOs="Other|手机系统" end if if vOs<>"Other|手机系统" then:getOS=vOS:exit Function:end if '---------再判定电脑系统 if instr(1,UserAgent,"Windows NT 6.1",1)>0 then vOS="Windows 7|电脑系统" elseif instr(1,UserAgent,"Windows NT 6.0",1)>0 then vOS="Windows Vista|电脑系统" elseif instr(1,UserAgent,"Windows NT 5.2",1)>0 then vOS="Windows 2003|电脑系统" elseif instr(1,UserAgent,"Windows NT 5.1",1)>0 then vOs="Windows XP|电脑系统" elseif instr(1,UserAgent,"Windows NT 5.0",1)>0 then vOS="Windows 2000|电脑系统" elseif instr(1,UserAgent,"Windows NT",1)>0 then vOs="Windows NT|电脑系统" '4.0 is win95 ,4.1 is win98 ,4.9 is win me elseif instr(1,UserAgent,"Windows 9",1)>0 or instr(1,UserAgent,"Windows 4",1)>0 then vOs="Windows 9x|电脑系统" elseif instr(1,UserAgent,"Unix",1)>0 or instr(1,UserAgent,"SunOS",1)>0 or instr(1,UserAgent,"BSD",1)>0 then vOs="Unix|电脑系统" elseif instr(1,UserAgent,"RedHat",1)>0 then vOs="Linux RedHat|电脑系统" elseif instr(1,UserAgent,"Ubuntu",1)>0 then vOs="Linux Ubuntu|电脑系统" elseif instr(1,UserAgent,"Linux",1)>0 then vOs="Linux|电脑系统" elseif instr(1,UserAgent,"Mac",1)>0 then vOs="Mac|电脑系统" else vOs="Other|电脑系统" end if if vOs<>"Other|电脑系统" then:getOS=vOS:exit Function:end if '以上判定电脑系统完完毕BlackBerry '-------最后判定搜索蜘蛛 '蜘蛛spiderAlcatel if instr(1,UserAgent,"Baiduspider",1)>0 then vOs="Baidu spider|搜索蜘蛛" elseif instr(1,UserAgent,"Googlebot",1)>0 then vOs="Google bot|搜索蜘蛛" elseif instr(1,UserAgent,"msnbot",1)>0 then vOs="Msn bot|搜索蜘蛛" elseif instr(1,UserAgent,"Yahoo",1)>0 then vOs="Yahoo bot|搜索蜘蛛" elseif instr(1,UserAgent,"Sogou",1)>0 then vOs="Sogou spider|搜索蜘蛛" elseif instr(1,UserAgent,"YodaoBot",1)>0 then vOs="Yodao Bot|搜索蜘蛛" elseif instr(1,UserAgent,"Sosospider",1)>0 then vOs="Soso spider|搜索蜘蛛" else vOs="Other|搜索蜘蛛" end if getOS=vOS if vOs="Other|搜索蜘蛛" then:vOs="Other|Other":getOS=vOS:exit Function:end if end Function Function getIE(UserAgent) if UserAgent="UserAgent Unknown" then :vOs="UserAgent isNull Browser Unknown|Other":getIE=vOS:exit Function:end if dim vOS '先判定使用IE内核的浏览器MAXTHON,GreenBrowser TencentTraveler MyIE NetCaptor if instr(1,UserAgent,"GreenBrowser",1)>0 then vOS="GreenBrowser|浏览器" elseif instr(1,UserAgent,"NetCaptor",1)>0 then vOS="NetCaptor|浏览器" elseif instr(1,UserAgent,"TencentTraveler",1)>0 then vOS="TencentTraveler|浏览器" elseif instr(1,UserAgent,"TheWorld",1)>0 then vOS="TheWorld|浏览器" elseif instr(1,UserAgent,"MAXTHON",1)>0 then vOS="Maxthon|浏览器" elseif instr(1,UserAgent,"MyIE",1)>0 then vOS="MyIE|浏览器" '用IE内核的浏览器的判定要在IE前进行 elseif instr(1,UserAgent,"MSIE 8",1)>0 then vOS="IE 8|浏览器" elseif instr(1,UserAgent,"MSIE 7",1)>0 then vOS="IE 7|浏览器" elseif instr(1,UserAgent,"MSIE 6",1)>0 then vOS="IE 6|浏览器" elseif instr(1,UserAgent,"MSIE 5.5",1)>0 then vOS="IE 5.5|浏览器" elseif instr(1,UserAgent,"MSIE 5",1)>0 then vOS="IE 5|浏览器" elseif instr(1,UserAgent,"MSIE 4",1)>0 then vOS="IE 4|浏览器" elseif instr(1,UserAgent,"MSIE 3",1)>0 then vOS="IE 3|浏览器" '下面是非IE内核浏览器 elseif instr(1,UserAgent,"Netscape",1)>0 then vOS="Netscape|浏览器" elseif instr(1,UserAgent,"Chrome",1)>0 then vOS="Chrome|浏览器" elseif instr(1,UserAgent,"Firefox",1)>0 then vOS="Firefox|浏览器" elseif instr(1,UserAgent,"Safari",1)>0 then vOS="Safari|浏览器" elseif instr(1,UserAgent,"Opera Mini",1)>0 then vOS="Opera Mini|浏览器" elseif instr(1,UserAgent,"Opera",1)>0 or instr(1,UserAgent,"Presto",1)>0 then vOS="Opera|浏览器" elseif instr(1,UserAgent,"R4EA",1)>0 then vOS="R4EA|浏览器" elseif instr(1,UserAgent,"UP",1)>0 then vOS="UP|浏览器" elseif instr(1,UserAgent,"UCWEB",1)>0 then vOS="UCWEB|浏览器" else vOS="Other|浏览器" end if getIE=vOS end Function %>
试试其它关键字
同语言下
.
根据User Agent来判定操作系统与浏览器类型
.
将PPT内容导出为JPG图片
.
Java屏幕截取
.
发送邮件组件
.
子窗体在父窗体指定的控件中显示
.
取文件的大小
.
从某个目录中筛选文件
.
VB脚本调用exe应用程序并传递参数
.
图像格式转换工具
.
洗牌算法
可能有用的
.
根据User Agent来判定操作系统与浏览器类型
.
将PPT内容导出为JPG图片
.
Java屏幕截取
.
发送邮件组件
.
子窗体在父窗体指定的控件中显示
.
取文件的大小
.
从某个目录中筛选文件
.
VB脚本调用exe应用程序并传递参数
.
图像格式转换工具
.
洗牌算法
贡献的其它代码
Label
Copyright © 2004 - 2024 dezai.cn. All Rights Reserved
站长博客
粤ICP备13059550号-3