Forum Discussion

kc2kth_49679's avatar
kc2kth_49679
Icon for Nimbostratus rankNimbostratus
Feb 24, 2009

Identify Mobile Device Browsers

Has anyone done any work with identifying mobile devices/browsers and redirecting them? We are building a new mobile friendly version of our site and want to send all mobile devices to that new site. I thought the solution would likely revolve around looking at headers to identify the device type or browser id. I was hoping someone had or knew of a list of these id's that I could check for.

 

3 Replies

  • Here is a post which has a few examples on how to check the User-Agent header for keywords to identify mobile devices:

     

     

    Redirect based on user browser (mobile) (Click here)

     

     

    You could also check the Accept header for indications that it's a mobile device:

     

     

    More Custom WAP iRules (Click here)

     

     

    Aaron
  • So I'm back on this project. Good info - thanks. Quick question though, which would potentially perform better, a switch or match class? I was leaning toward the match class method, but noticed in the examples a switch was used that at least appears efficient.

     

     

    So far the strategy worked up by myself and others here is to grab the common standard browsers and send them on their way first, using a class or switch here as well. Then handling the top n known mobiles and sending them to the mobile site via the switch/class. Finally log the user agent of remaining, unidentified clients and redirect them.

     

     

    I'm still struggling with a good way to identify these browsers. I'm not sure I quite grasp what I'm looking for in the HTTP::Accept field.
  • For a lot (more than ~100?) comparisons, I think a class is faster than a switch statement (Click here).

     

     

    The Accept header could contain strings which are specific to a WAP device like "RIM" or "WAP" for example.

     

     

    Aaron