判断浏览器是否支持wml

 /*判断浏览器是否支持wml            
通过 Request.ServerVariables("HTTP_USER_AGENT")来获得,一般包含:CECT,Compal,CTL,LG,NEC,TCL,Alcatel,Ericsson,BIRD,DAXIAN,DBTEL,Eastcom,PANTECH,Dopod,PHILIPS,HAIER,KONKA,KEJIAN,LENOVO,BenQ,MOT,Soutec,Nokia,SAGEM,SGH,SED,Capitel,Panasonic,SonyEricsson,SIE,SHARP,Amoi,PANDA,ZTE"那么是具品牌特征的手机其次简单方法具有例外:Request.ServerVariables("HTTP_X_WAP_PROFILE")这个是手机特征            

* 高级运用:Request.ServerVariables("HTTP_ACCEPT") 包含 vnd.wap.wml同时 Request.ServerVariables("HTTP_ACCEPT")不包含 "text/html"
这里判断就是标准WAP,也就是不支持HTML方式输出,常见手机浏览器都这样Request.ServerVariables("HTTP_ACCEPT") 包含 vnd.wap.wml,同时 Request.ServerVariables("HTTP_ACCEPT")包含 "text/html"如果 vnd.wap.wml 在 text/html之前,那么就是支持HTML的浏览器,比如OPERA,等,PPC和PDA常见,比如PALM如果 vnd.wap.wml 在 text/html之后,那么就是模拟器了,一般是电脑用户通过WAP浏览器访问:)   Request.Browser.Capabilities["inputType"] pc是keyboard  手机是telephoneKeypad ,但模拟器也是telephoneKeypad ,Request.UserAgent 手机可能null 电脑的肯定有内容,             

* <% Response.Buffer = TRUE   Dim IsWap   httpAccept = LCase(Request.ServerVariables("HTTP_ACCEPT"))   if Instr(httpAccept,"wap") then   IsWap=1   Else Response.Redirect "http://www.gelon.net/cgi-bin/wapalize.cgi?url=http://hikey.net/wap" Response.End End if %>

================

各种浏览器的参数信息

Request.ServerVariables["HTTP_ACCEPT"]属性UC浏览器application/vnd.wap.xhtml+xml,application/xml,text/vnd.wap.wml,text/html,application/xhtml+xml,image/jpeg;q=0.5,image/png;q=0.5,image/gif;q=0.5,image/*;q=0.6,video/*,audio/*,*/*;q=0.6,UC/27
QQ浏览器text/vnd.wap.wml,text/html, application/vnd.wap.xhtml+xml,application/xhtml+xml,application/xml, image/jpeg;q=0.5,image/png;q=0.5,image/gif;q=0.5,image/*;q=0.6, */*;q=0.6
自带浏览器text/html, application/vnd.wap.xhtml+xml, application/xhtml+xml, text/css, multipart/mixed, text/vnd.wap.wml, application/vnd.wap.wmlc, application/vnd.wap.wmlscriptc, application/java-archive, application/java, application/x-java-archive, text/vnd.sun.j2me.app-descriptor, application/vnd.met.ticket, application/x-wallet-appl.user-data-provision, application/vnd.oma.drm.message, application/vnd.oma.drm.content, application/vnd.wap.mms-message, application/vnd.wap.sic, text/x-co-desc, application/vnd.oma.dd+xml, application/x-javascript, text/ecmascript, */*
山寨手机自带浏览器application/xhtml+xml;;profile=http://www.wapforum.org/xhtml,application/vnd.wap.xhtml+xml,application/vnd.wap.wmlc,application/vnd.wap.wmlscriptc,text/vnd.wap.wml,image/vnd.wap.wbmp,image/gif,image/bmp,image/png,audio/amr,audio/imelody,audio/midi,audio/wav,application/vnd.wap.wtls-ca-certificate,application/x-x509-ca-cert,application/vnd.wap.hashed-certificate,application/vnd.wap.signed-certificate,*/*,text/html

pc opera浏览器text/html, application/xml;q=0.9, application/xhtml+xml, image/png, image/jpeg, image/gif, image/x-xbitmap, */*;q=0.1

TT浏览器*/*
chrome浏览器application/xml,application/xhtml+xml,text/html;q=0.9,text/plain;q=0.8,image/png,*/*;q=0.5-------------------------------Request.UserAgent  属性手机浏览器都为nullTT浏览器Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1; SV1; TencentTraveler ; .NET CLR 1.1.4322; .NET CLR 2.0.50727; .NET CLR 3.0.04506.648; .NET CLR 3.5.21022; .NET CLR 3.0.4506.2152; .NET CLR 3.5.30729)
chrome浏览器Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US) AppleWebKit/534.16 (KHTML, like Gecko) Chrome/10.0.648.205 Safari/534.16
pc opera浏览器Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1; zh-cn) Opera 8.53
Opera/9.80 (Windows NT 5.1; U; zh-cn) Presto/2.8.131 Version/11.10
===============

模拟器的userAgent和accept(有wmlscriptc,或者text/html在vnd.wap.wml前面application/vnd.wap.wmlscriptc, text/vnd.wap.wml, application/vnd.wap.xhtml+xml, application/xhtml+xml, text/html, multipart/mixed, */*
Amoi-F90/Plat-F/WAP2.0/MIDP1.0/CLDC1.0 UP.Browser/6.2.2.6.f.1.100 (GUI) MMP/1.0
==================text/html, application/vnd.wap.xhtml+xml, application/xhtml+xml, text/css, multipart/mixed, text/vnd.wap.wml, application/vnd.wap.wmlc, application/vnd.wap.wmlscriptc, application/java-archive, application/java, application/x-java-archive, text/vnd.sun.j2me.app-descriptor, application/vnd.oma.drm.message, application/vnd.wap.mms-message, application/vnd.wap.sic, text/x-co-desc, application/vnd.oma.dd+xml, text/vnd.nokia.rs-tgd, */*, text/x-vcard, text/x-vcalendar, image/gif, image/vnd.wap.wbmp
Nokia 5320/UCWEB7.4.0.57/28/800
===========text/html, application/xhtml+xml, application/xml;q=0.9, */*;q=0.8, text/vnd.wap.wml;q=0.6, image/png, image/jpeg, image/gif, image/x-xbitmap
Nokia 5320/UCWEB7.0.2.37/28/999

posted @ 2011-05-25 11:01  看来是  阅读(2423)  评论(0编辑  收藏  举报