This class has come in very handy. I use it to change the behavior of my sites. For example, I could have a light box on an image or contact form but it really doesn’t do any good on a phone. the image inside the lightbox is often smaller than in was in the browser. So I will remove css classes from the element which causes the browser to go to the contact form or the actual image instead.
Mobile Detect is a lightweight PHP class for detecting mobile devices (including tablets). It uses the User-Agent string combined with specific HTTP headers to detect the mobile environment.
You may consider this script as being part of the RESS (Responsive Web Design with Server-Side Component) movement. You can find out more on the topic by reading these articles: Improve Mobile Support With Server-Side-Enhanced Responsive Design and RESS: Responsive Design + Server Side Components.
You can also benefit from Mobile Detect by using any of the 3rd party plugins available for: WordPress, Drupal, Joomla, Magento, etc.
Posted by Daniel