Detect mobile browser in asp


/ Published in: ASP
Save to your folder(s)

Detect if browser is a mobile in asp


Copy this code and paste it in your HTML
  1. <%
  2. Function Is_Mobile()
  3. Is_Mobile= instr("|up.browser|up.link|mmp|symbian|smartphone|midp|wap|phone|windows ce|pda|mobile|mini|palm|ipad|","|" & Request.ServerVariables("HTTP_USER_AGENT") & "|" ) > 0
  4. End Function
  5. %>
  6.  
  7. //USAGE
  8.  
  9. <%If Is_Mobile() then%>
  10. <h1>You are using a mobile device</h1>
  11. <%Else%>
  12. <h1>You are not using a mobile device</h1>
  13. <%End If%>

Report this snippet


Comments

RSS Icon Subscribe to comments

You need to login to post a comment.