Skip to main content
Participating Frequently
May 28, 2012
Question

Mobile detection...

  • May 28, 2012
  • 1 reply
  • 605 views

Hey guys, any real good way to configure a mobile detection. All my sites are flash based and if i can make it where a iPhone tried to log in it takes them to a mobile version of my site.

I have heard its not flash but its really how i wrote the HTML ??

Thanks

This topic has been closed for replies.

1 reply

kglad
Community Expert
Community Expert
May 28, 2012

in your main html you can use javascript to detect the user agent.

here's sample code for the iphone and ipad and android and blackberry:

<script type="text/javascript">

ua=navigator.userAgent.toLowerCase();

if((ua.indexOf("iphone")>-1) ||  (ua.indexOf("ipad")>-1) || (ua.indexOf("android")>-1) || (ua.indexOf("blackberry")>-1 {

   if (document.cookie.indexOf("iphone_redirect=false") == -1) {

window.location = "http://yoursite.com/mobile/index.html/";

}

}

</script>