ASP网站识别手机访问 首页内页实现自动跳转
很多ASP网站站长都知道,ASP网站自带了手机访问首页实现自动跳转移动手机站首页的功能,可是没有手机移动端访问内页时,自动跳转到对应的手机移动端内页的功能。经过研究,电商博客就自己的方法分享给大家,轻松实现ASP网站识别手机移动端访问, 首页和内页分别实现自动跳转到对应手机移动端页面的功能。
ASP网站首页识别手机访问实现自动跳转
Sub Check_Wap() dim MoblieUrl,reExp,MbStr MoblieUrl="http://m.cqfoxconnjob.com"'此为手机网站路径,各位在复制代码时只要将此路径修改成指定手机网站的路径即可。推荐使用独立手机网站域名。 Set reExp = New RegExp MbStr="Android|iPhone|UC|Windows Phone|webOS|BlackBerry|iPod" reExp.pattern=".*("&MbStr&").*" reExp.IgnoreCase = True reExp.Global = True If reExp.test(Request.ServerVariables("HTTP_USER_AGENT")) Then response.redirect MoblieUrl response.End End If End Sub
ASP网站内页识别手机访问实现自动跳转
Sub PageCheck_Wap() dim MoblieUrl,reExp,MbStr MoblieUrl="http://m.cqfoxconnjob.com"&GetLocationURL Set reExp = New RegExp MbStr="Android|iPhone|UC|Windows Phone|webOS|BlackBerry|iPod" reExp.pattern=".*("&MbStr&").*" reExp.IgnoreCase = True reExp.Global = True If reExp.test(Request.ServerVariables("HTTP_USER_AGENT")) Then response.redirect MoblieUrl response.End End If End Sub Function GetLocationURL() Dim Url Dim ServerPort,ServerName,ScriptName,QueryString ServerName = Request.ServerVariables("SERVER_NAME") ServerPort = Request.ServerVariables("SERVER_PORT") ScriptName = Request.ServerVariables("SCRIPT_NAME") QueryString = Request.ServerVariables("QUERY_STRING") Url=ServerName If ServerPort <> "80" Then Url = Url & ":" & ServerPort Url=ScriptName If QueryString <>"" Then Url=Url&"?"& QueryString GetLocationURL=Url End Function
发表于2017-06-26 21:45
本站所有产品(域名、企业邮局除外):买两年送一年、买三年送两年、买五年送五年、买十年送十年,另免费送500M容量企业邮局。
主机支持现今大部分主流网站源码,如:discuz、帝国、织梦、柯林、槟榔、快范等等等等,如有需要,购买主机后也可联系我们协助安装。
发表于2017-06-06 06:20
2017-06-26 01:42
发表于2017-06-02 06:17
发表于2017-05-28 06:41
发表于2017-04-23 12:56
发表于2017-04-14 06:34
发表于2017-04-01 14:11
发表于2017-03-04 05:48
发表于2017-03-01 07:45
发表于2017-02-25 04:53
发表于2017-02-15 08:37
发表于2017-01-15 03:08
发表于2017-01-10 08:19
发表于2016-12-26 02:57
发表于2016-12-20 13:43