HOME
BBS
深山帮帮欢迎您,您可以注册或者
qq登录只需一步,快速开始
深山旅行社网站管理系统开发完成,欢迎各位网友测试! 点这里测试
565449214 给站长留言
订阅本栏目 RSS您所在的位置: 深山工作室 > ASP学习 > 正文

asp判断是否是手机访问

网络 2015-3-11 9:06:06 深山 字体:  浏览 4945 我要评论
asp判断浏览器是否是手机版的,如果是手机版,就跳转相应的页面

<%
qwbmmobilefeatures = "mini 9.5|vx1000|lge|m800|e860|u940|ux840|compal|wireless| mobi|ahong|lg380|lgku|lgu900|lg210|lg47|lg920|lg840|lg370|sam-r|mg50|s55|g83|t66|vx400|mk99|d615|d763|el370|sl900|mp500|samu3|samu4|vx10|xda_|samu5|samu6|samu7|samu9|a615|b832|m881|s920|n210|s700|c-810|_h797|mob-x|sk16d|848b|mowser|s580|r800|471x|v120|rim8|c500foma:|160x|x160|480x|x640|t503|w839|i250|sprint|w398samr810|m5252|c7100|mt126|x225|s5330|s820|htil-g1|fly v71|s302|-x113|novarra|k610i|-three|8325rc|8352rc|sanyo|vx54|c888|nx250|n120|mtk |c5588|s710|t880|c5005|i;458x|p404i|s210|c5100|teleca|s940|c500|s590|foma|samsu|vx8|vx9|a1000|_mms|myx|a700|gu1100|bc831|e300|ems100|me701|me702m-three|sd588|s800|8325rc|ac831|mw200|brew |d88|htc\/|htc_touch|355x|m50|km100|d736|p-9521|telco|sl74|ktouch|m4u\/|me702|8325rc|kddi|phone|lg |sonyericsson|samsung|240x|x320vx10|nokia|sony cmd|motorola|up.browser|up.link|mmp|symbian|smartphone|midp|wap|vodafone|o2|pocket|kindle|mobile|psp|treo|iris|3g_t|windows ce|opera mobi|windows ce; smartphone;|windows ce; iemobile|ipod|iphone|android|opera mini|blackberry|palm os|palm|hiptop|avantgo|fennec|plucker|xiino|blazer|elaine|iris|3g_t|windows ce|opera mobi|windows ce; smartphone;|windows ce; iemobile|UC|Windows Phone|webOS|vnd.wap"


call Check_Wap()

Sub Check_Wap()
dim MoblieUrl,reExp,MbStr
Set reExp = New RegExp
MbStr="UC|Windows Phone|webOS|BlackBerry|iPod|vnd.wap|wap|symbian"
reExp.pattern=".*("&MbStr&").*"
reExp.IgnoreCase = True
reExp.Global = True
If reExp.test(Request.ServerVariables("HTTP_USER_AGENT")) Then
MoblieUrl="/3g/index.asp"''手机网站路径
'response.redirect MoblieUrl
response.write "<font color='#f60'>这个是WAP手机版</font>"
'response.End
else
response.write "<font color='#09f'>这个是PC版</font>"
'response.End
End If
End Sub





'If instr(lcase(Request.ServerVariables("ALL_HTTP")),"vnd.wap")>0 or instr(lcase(Request.ServerVariables("ALL_HTTP")),"iphone")>0 or instr(lcase(Request.ServerVariables("ALL_HTTP")),"android")>0 or instr(lcase(Request.ServerVariables("ALL_HTTP")),"wap")>0 Or instr(lcase(Request.ServerVariables("All_HTTP")),"symbian") > 0 Or instr(lcase(Request.ServerVariables("All_HTTP")),"windows phone") > 0 Then
'response.Redirect("http://m.qwbm.com/?agent_id=494948")
'End If

'**************************************************

'函数名:websitez_detect_mobile_device

'作  用:判断访问浏览器的类型

'参  数:

'返回值:浏览器类型

'函数名:regexpmobiletest

'作  用:在正则表达式中搜索给定的字符串,找到返回 true

'参  数:

'返回值:布尔型

'日期:11-12-18




'**************************************************
Function regexpmobiletest(patrn, strng)
Dim regEx, retVal '建立变量
Set regEx=New RegExp '建立正则表达式
regEx.Pattern=patrn '设置模式
regEx.IgnoreCase=True '设置是否区分大小写,true为不区分
retVal=regEx.Test(strng)'执行搜索测试
regexpmobiletest=retVal
End Function 

function webmobilereturn(wmleis)
dim mobile_browser,user_agent, accept,mobile_browser_type
mobile_browser = "0"
user_agent=Trim(Lcase(Request.ServerVariables("HTTP_USER_AGENT")))
accept = Request.ServerVariables("HTTP_ACCEPT")
mobile_browser_type = "0" '0 - PC, 1 - Smart Phone, 2- Standard Phone  3 touch phone
'Select case true
if InStr(user_agent,"ipod")>0 or InStr(user_agent,"iphone")>0 or InStr(user_agent,"ipad")>0 then 'iPhone or iPod
mobile_browser = "1"
mobile_browser_type = "3" 'Smart Phone
elseif InStr(user_agent,"android")>0 then 'Android
mobile_browser = "1"
mobile_browser_type = "3" 'Smart Phone
elseif InStr(user_agent,"opera mini")>0 then 'Opera Mini
mobile_browser = "1"
mobile_browser_type = "1" 'Smart Phone
elseif InStr(user_agent,"blackberry")>0 then 'Blackberry
mobile_browser = "1"
mobile_browser_type = "1" 'Smart Phone
elseif InStr(user_agent,"series60")>0 or InStr(user_agent,"series 60")>0 then 'Symbian OS
mobile_browser = "1"
mobile_browser_type = "1" 'Smart Phone
elseif regexpmobiletest("(pre\/|palm os|palm|hiptop|avantgo|plucker|xiino|blazer|elaine)",user_agent) then 'Palm OS
mobile_browser = "1"
mobile_browser_type = "1" 'Smart Phone
elseif regexpmobiletest("(iris|3g_t|windows ce|opera mobi|iemobile)",user_agent) then 'Windows OS
mobile_browser = "1"
mobile_browser_type = "1" 'Smart Phone
elseif regexpmobiletest("(maemo|tablet|qt embedded|com2)",user_agent) then 'Nokia Tablet
mobile_browser = "1"
mobile_browser_type = "1" 'Smart Device
elseif regexpmobiletest("(mini 9.5|vx1000|lge |m800|e860|u940|ux840|compal|wireless| mobi|ahong|lg380|lgku|lgu900|lg210|lg47|lg920|lg840|lg370|sam-r|mg50|s55|g83|t66|vx400|mk99|d615|d763|el370|sl900|mp500|samu3|samu4|vx10|xda_|samu5|samu6|samu7|samu9|a615|b832|m881|s920|n210|s700|c-810|_h797|mob-x|sk16d|848b|mowser|s580|r800|471x|v120|rim8|c500foma:|160x|x160|480x|x640|t503|w839|i250|sprint|w398samr810|m5252|c7100|mt126|x225|s5330|s820|htil-g1|fly v71|s302|-x113|novarra|k610i|-three|8325rc|8352rc|sanyo|vx54|c888|nx250|n120|mtk |c5588|s710|t880|c5005|i;458x|p404i|s210|c5100|teleca|s940|c500|s590|foma|samsu|vx8|vx9|a1000|_mms|myx|a700|gu1100|bc831|e300|ems100|me701|me702m-three|sd588|s800|8325rc|ac831|mw200|brew |d88|htc\/|htc_touch|355x|m50|km100|d736|p-9521|telco|sl74|ktouch|m4u\/|me702|8325rc|kddi|phone|lg |sonyericsson|samsung|240x|x320|vx10|nokia|sony cmd|motorola|up.browser|up.link|mmp|symbian|smartphone|midp|wap|vodafone|o2|pocket|kindle|mobile|psp|treo|vnd.rim|wml|nitro|nintendo|wii|xbox|archos|openweb|mini|docomo)",user_agent) then 'Mix of standard phones
mobile_browser = "1"
mobile_browser_type = "2" 'Standard Phone
elseif InStr(accept,"text/vnd.wap.wml")> 0 or InStr(accept,"application/vnd.wap.xhtml+xml")>0 then 'Any falling through the cracks
mobile_browser = "1"
mobile_browser_type = "2" 'Standard Phone
elseif Request.ServerVariables("HTTP_X_WAP_PROFILE")<>"" or Request.ServerVariables("HTTP_PROFILE")<>"" then 'Anyfalling through the cracks
mobile_browser = "1"
mobile_browser_type = "2" 'Standard Phone
elseif ubound(filter(array("1207","3gso","4thp","501i","502i","503i","504i","505i","506i","6310","6590","770","802s","a wa","acer","acs","airn","alav","asus","attw","au-m","aur ","aus ","abac","acoo","aiko","alco","alca","amoi","anex","anny","anyw","aptu","arch","argo","bell","bird","bw-n","bw-u","beck","benq","bilb","blac","c55/","cdm-","chtm","capi","cond","craw","dall","dbte","dc-s","dica","ds-d","ds12","dait","devi","dmob","doco","dopo","el49","erk0","esl8","ez40","ez60","ez70","ezos","ezze","elai","emul","eric","ezwa","fake","fly-","fly_","g-mo","g1 u","g560","gf-5","grun","gene","go.w","good","grad","hcit","hd-m","hd-p","hd-t","hei-","hp i","hpip","hs-c","htc ","htc-","htca","htcg","htcp","htcs","htct","htc_","haie","hita","huaw","hutc","i-20","i-go","i-ma","i230","iac","iac-","iac/","ig01","im1k","inno","iris","jata","java","kddi","kgt","kgt/","kpt ","kwc-","klon","lexi","lg g","lg-a","lg-b","lg-c","lg-d","lg-f","lg-g","lg-k","lg-l","lg-m","lg-o","lg-p","lg-s","lg-t","lg-u","lg-w","lg/k","lg/l","lg/u","lg50","lg54","lge-","lge/","lynx","leno","m1-w","m3ga","m50","maui","mc01","mc21","mcca","medi","meri","mio8","mioa","mo01","mo02","mode","modo","mot ","mot-","mt50","mtp1","mtv ","mate","maxo","merc","mits","mobi","motv","mozz","n100","n101","n102","n202","n203","n300","n302","n500","n502","n505","n700","n701","n710","nec-","nem-","newg","neon","netf","noki","nzph","o2 x","o2-x","opwv","owg1","opti","oran","p800","pand","pg-1","pg-2","pg-3","pg-6","pg-8","pg-c","pg13","phil","pn-2","pt-g","palm","pana","pire","pock","pose","psio","qa-a","qc-2","qc-3","qc-5","qc-7","qc07","qc12","qc21","qc32","qc60","qci-","qwap","qtek","r380","r600","raks","rim9","rove","s55/","sage","sams","sc01","sch-","scp-","sdk/","se47","sec-","sec0","sec1","semc","sgh-","shar","sie-","sk-0","sl45","slid","smb3","smt5","sp01","sph-","spv ","spv-","sy01","samm","sany","sava","scoo","send","siem","smar","smit","soft","sony","t-mo","t218","t250","t600","t610","t618","tcl-","tdg-","telm","tim-","ts70","tsm-","tsm3","tsm5","tx-9","tagt","talk","teli","topl","hiba","up.b","upg1","utst","v400","v750","veri","vk-v","vk40","vk50","vk52","vk53","vm40","vx98","virg","vite","voda","vulc","w3c ","w3c-","wapj","wapp","wapu","wapm","wig ","wapi","wapr","wapv","wapy","wapa","waps","wapt","winc","winw","wonu","x700","xda2","xdag","yas-","your","zte-","zeto","acs-","alav","alca","amoi","aste","audi","avan","benq","bird","blac","blaz","brew","brvw","bumb","ccwa","cell","cldc","cmd-","dang","doco","eml2","eric","fetc","hipt","http","ibro","idea","ikom","inno","ipaq","jbro","jemu","java","jigs","kddi","keji","kyoc","kyok","leno","lg-c","lg-d","lg-g","lge-","libw","m-cr","maui","maxo","midp","mits","mmef","mobi","mot-","moto","mwbp","mywa","nec-","newt","nok6","noki","o2im","opwv","palm","pana","pant","pdxg","phil","play","pluc","port","prox","qtek","qwap","rozo","sage","sama","sams","sany","sch-","sec-","send","seri","sgh-","shar","sie-","siem","smal","smar","sony","sph-","symb","t-mo","teli","tim-","tosh","treo","tsm-","upg1","upsi","vk-v","voda","vx52","vx53","vx60","vx61","vx70","vx80","vx81","vx83","vx85","wap-","wapa","wapi","wapp","wapr","webc","whit","winw","wmlb","xda-"),Mid(user_agent,1,4),true))>-1 then 'Catch all
mobile_browser = "1"
mobile_browser_type = "2" 'Standard Phone
'Case Else
else
mobile_browser = "0"
mobile_browser_type = "0"
'End Select
End if
if wmleis = "1" then
webmobilereturn = mobile_browser
else
webmobilereturn = mobile_browser_type
end if
end function

response.write webmobilereturn(0) & "___<br>"
response.write webmobilereturn(1) & "___<br>"
response.write mobile_browser & "___<br>"
response.write mobile_browser_type & "___<br>"
response.write user_agent & "___<br>"
response.write accept & "___<br>"
response.end



%>


Ads loading...
相关阅读
( 2015-10-22 17:42:13 )深山旅行社网站管理系统5.0发布
( 2015-3-11 9:06:06 )asp判断是否是手机访问
( 2015-3-11 9:03:55 )asp利用正则检查手机端的浏览器标识来确定是否是手机访问 如果是手机访问就使用手机模板
( 2013-10-31 15:05:49 )安卓ES文件浏览器访问电脑上共享文件夹设置
( 2010-1-20 13:40:45 )ASP汉字转拼音,支持自定义特殊词语
( 2009-12-22 14:07:40 )告诉你一些GOOGLE搜索你不知道的东西
( 2009-9-16 21:32:43 )微软公司的三道面试题目看了会有意想不到的收获
( 2009-9-3 8:28:37 )绝对让你长见识:200个骗人的创业项目!
共有0条关于《asp判断是否是手机访问》的评论
发表评论
正在加载评论……
返回顶部发表评论
呢 称:
表 情:
内 容:
评论内容:不能超过 400 字,需审核,请自觉遵守互联网相关政策法规。
验证码: 验证码 
深山工作室网友评论声明,请自觉遵守互联网相关政策法规。

您发布的评论即表示同意遵守以下条款:
一、不得利用本站危害国家安全、泄露国家秘密,不得侵犯国家、社会、集体和公民的合法权益;
二、不得发布国家法律、法规明令禁止的内容;互相尊重,对自己在本站的言论和行为负责;
三、本站对您所发布内容拥有处置权。

Ads loading...
更多信息>>栏目类别选择
rss学习
个人空间
网站设计
网站公告
下载
photoshop学习
ASP学习
DIV+CSS学习
SEO搜索引擎忧化
java学习
HTML学习
网站信息
网站类信息
更多>>同类信息
批量删除access字段里面fld.Properties.Delete
ASP操作access或sqlserver数据库的函数库
asp中求两个数的百分比(利用百分比函数FormatPercent就可以自带%的符号)
asp利用sql操作数据表、数据库的一些方法
rs操作数据表记录集对象的方法
[转载]中国行政区划数据(省市区街道)
ASP版通过身份证信息获取对应的生日性别年龄
ASP网站打开特别卡 提示:msxml3.dll 错误 '80072ee2' /LM/W3SVC/670931603/Root/global.asa解决办法
Ads loading...
更多>>最新添加文章
批量删除access字段里面fld.Properties.Delete
ASP操作access或sqlserver数据库的函数库
asp采用access数据库搜索信息时因为日文片假名问题提示“Microsoft JET Database Engine 错误80040e14”的解决方法
asp中求两个数的百分比(利用百分比函数FormatPercent就可以自带%的符号)
asp利用sql操作数据表、数据库的一些方法
rs操作数据表记录集对象的方法
asp利用dateadd获得上个月、本月、下个月的第一天和最后一天
asp随机显示字符长度与类型(可随机显示数字、小写字母、大写字母,可以做为随机密码使用)
  • 业务 QQ:565449214
  • 手机:139 6134 7334
更多>>随机抽取信息
利用ASP正则提取文章里面的图片的有效的src地址
超级酷的滚动条颜色代码生成器
非常酷的javascript实现万年历功能
一个更加高级的CSS菜单,绝对实用,超强的
倒计时广告/始终保持在网页中部
设置自己个性的网页滚动条附详细介绍
asp之自动闭合UBB标签函数
div默认高度根据内容自动适应高度
Ads loading...