Posted By

lakkie on 10/03/13


Tagged


Versions (?)

Detect mobile browser in asp


 / Published in: ASP
 

Detect if browser is a mobile in asp

  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  

You need to login to post a comment.