Tuesday, March 20, 2012

Detect Mobile Browsers using jQuery

Yesterday, one of my reader asked me that how to redirect user to mobile site if the website is viewed from mobile. In short, How to detect the mobile browser. Well, previously I had posted about "Detect Android Devices/Phone using jQuery" and "Detect Apple Devices (iPad, iPhone, iPod) using jQuery" but that is not going to work for all the mobile browsers available in the market.


Related Post:

So while looking for a solution, I came across a website called Detect Mobile Browsers, which provides scripts for almost every language to detect the mobile browser.
After downloading the script, Save it in seperate .js file (as it gets downloaded in plain text format) and reference it in your page. Now you need to check the value of "jQuery.browser.mobile". It will be true if the browser is a mobile device, otherwise false.

Feel free to contact me for any help related to jQuery, I will gladly help you.