Redirecting depending on user's platform

We're working on a MAF project where you have a web application that can be accessed through two different hosts, one for a mobile "brand" and another for a desktop browser "brand", both existing in the same app server. Before hitting the app server, a load balancer (BigIP) processes some iRules to determine the URL depending on a parameter sent in the query string. We'd like to see if there's another way to pull this by the user's User-Agent header or something like that. I've been told that a product called BrowserHawk already does this kind of logic to detect user's platform, maybe this can help us. Any help would be appreciated.

Answers

  • If all you need to do is detect a mobile user agent, I would recommend against using BrowserHawk... as it comes with licensing restrictions, cost money, etc. There are plenty of free and open source ways to detect if a user is a mobile or tablet user without using BrowserHawk. Both BrowserHawk and these other methods will inspect the user's user agent header. That said, if you need something more complete BrowserHawk definitely offers more capabilities.
  • First, what is the purpose of the mobile site? Is it really a small form factor (e.g. small screen, <480px wide) concern? If so, I am an advocate of CSS Media Queries, or a JavaScript library that does the same (like [Respond.js][1]). Detect the device width and redirect to the proper site, and don't concern over User Agents. However, if you are using the OnePass COSI screens, BrowserHawk can run there and provide the results as part of the redirect flow back to the application. Definitely keep the logic out of the iRules [1]:
    https://github.com/scottjehl/Respond
  • Good point, use media queries if possible! Responsive design ftw!
  • Does your solution require the user to be able to switch between the desktop and browser versions of the application?
  • Are you using modernizr by anychance? That will help in userAgent detection.
    http://modernizr.com/