Return to Snippet

Revision: 63564
at May 17, 2013 02:32 by nshakin

Initial Code
Function Is_Mobile()
  Set Regex = New RegExp
  With Regex
    .Pattern = "(up.browser||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
    Is_Mobile = True
    Is_Mobile = False
  End If
End Function


<%If Is_Mobile() then%>
	<h1>You are using a mobile device</h1>
  	<h1>You are not using a mobile device</h1>
<%End If%>

Initial URL

Initial Description
A function and if statement to detect whether or not the browser is a mobile device.

Initial Title
Detect Mobile Browser Using ASP

Initial Tags
browser, mobile, ASP

Initial Language