Determining Site Visitor Device Type

Bob Schneider
Bob Schneider used Ask the Experts™
on
I need a concise way to determine if a user is on a mobile device or not using classic asp.  it would be nice, although not necessary, to know if they are using apple or pc.  I assume it has to do with Request.ServerVariables("HTTP_USER_AGENT")?

Thank you!
Comment
Watch Question

Do more with

Expert Office
EXPERT OFFICE® is a registered trademark of EXPERTS EXCHANGE®
https://stackoverflow.com/questions/2836203/detect-mobile-user-agent-from-classic-asp-and-redirect-on-session-start
Detect mobile user agent from classic ASP
Function is_mobile()
    Dim Regex, match
    Regex = New RegExp
    With Regex
        .Pattern = "(up.browser|up.link|mmp|symbian|smartphone|midp|wap|phone|windows ce|pda|mobile|mini|palm|ipad|Android|BlackBerry|iPhone|iPod|Palm|Symbian)"
        .IgnoreCase = True
        .Global = True
    End With
    match = Regex.test(Request.ServerVariables("HTTP_USER_AGENT"))
    If match Then
        is_mobile = True
    Else
        is_mobile = False
    End If
End Function

Open in new window

Bob SchneiderCo-Owner

Author

Commented:
Thank you very much!
Bob SchneiderCo-Owner

Author

Commented:
Oops.  I get this on you rline 3: Object doesn't support this property or method Err #:
Bob SchneiderCo-Owner

Author

Commented:
Oops again.  We're good!!!

Do more with

Expert Office
Submit tech questions to Ask the Experts™ at any time to receive solutions, advice, and new ideas from leading industry professionals.

Start 7-Day Free Trial