从经典 ASP 检测移动用户代理并在会话开始时重定向 [英] Detect mobile user agent from classic ASP and redirect on session start

查看:24
本文介绍了从经典 ASP 检测移动用户代理并在会话开始时重定向的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想检测移动用户代理并在经典 ASP 应用程序中启动会话时重定向它们.有谁知道解决这个问题的好方法吗?

I'd like to detect a mobile user agent and redirect them when the session starts in a classic ASP app. Does anyone know a good way to pull this off?

推荐答案

看一看:

http://mobiforge.com/developing/story/lightweight-device-检测-asp

sub is_mobile()
  Dim Regex, match
  Set Regex = New RegExp
     With Regex
        .Pattern = "(up.browser|up.link|mmp|symbian|smartphone|midp|wap|phone|windows ce|pda|mobile|mini|palm|ipad)"
        .IgnoreCase = True
        .Global = True
      End With
   match = Regex.test(Request.ServerVariables("HTTP_USER_AGENT"))
   If match Then
      return True
   Else
      return False
   End If
End Sub

*免责声明:代码可能无法工作,因为我没有方法测试它并且对经典 ASP 知之甚少.

*Disclaimer: the code may not work, as I have no method to test it and little knowledge of classic ASP.

这篇关于从经典 ASP 检测移动用户代理并在会话开始时重定向的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆