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|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
    Is_Mobile = True
  Else
    Is_Mobile = False
  End If
End Function
%>

//USAGE 

<%If Is_Mobile() then%>
	<h1>You are using a mobile device</h1>
<%Else%>
  	<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
ASP