假如你的网址是:http://hi.baidu.com/aspxjsp/那你的Index.asp是http://hi.baidu.com/aspxjsp/index.asp那你的wap.asp是http://hi.baidu.com/aspxjsp/wap.asp那你的代码如下:%FunctionCheckMobile()\'是否由wap转入电脑版IfNotIsEmpty(Request.ServerVariables(\"HTTP_REFERER\"))AndInStr(LCase(Request.ServerVariables(\"HTTP_REFERER\")),\"wap.asp\")=0ThenCheckMobile=False:ExitFunctionEndIf\'是否专用wap浏览器IfInStr(LCase(Request.ServerVariables(\"HTTP_ACCEPT\")),\"application/vnd.wap.xhtmlxml\")OrNotIsEmpty(Request.ServerVariables(\"HTTP_X_PROFILE\"))OrNotIsEmpty(Request.ServerVariables(\"HTTP_PROFILE\"))ThenCheckMobile=True:ExitFunctionEndIf\'是否(智能)手机浏览器DimMobileBrowser_List,PCBrowser_List,UserAgentMobileBrowser_List=\"up.browser|up.link|mmp|iphone|android|wap|netfront|java|opera\\smini|ucweb|windows\\sce|symbian|series|webos|sonyericsson|sony|blackberry|cellphone|dopod|nokia|samsung|palmsource|palmos|pda|xphone|xda|smartphone|pieplus|meizu|midp|cldc|brew|tear\"PCBrowser_List=\"mozilla|chrome|safari|opera|m3gate|winwap|openwave\"UserAgent=LCase(Request.ServerVariables(\"HTTP_USER_AGENT\"))IfCheckRegExp(UserAgent,MobileBrowser_List)ThenCheckMobile=True:ExitFunctionElseIfCheckRegExp(UserAgent,PCBrowser_List)Then\'未知手机浏览器,其UA标识为常见浏览器,不跳转CheckMobile=False:ExitFunctionElseCheckMobile=FalseEndIfEndFunctionIfCheckMobile()ThenResponse.Redirect(“http://hi.baidu.com/aspxjsp/wap.asp\")%要想代码能用,你还需要CheckRegExp(UserAgent,MobileBrowser_List)这个函数的定义,就像上面的FunctionCheckMobile()一样。追问CheckRegExp(UserAgent,MobileBrowser_List)怎么定义呢,能给下代码吗,谢谢了,ASP不懂,只会简单点的。
|