Introduction
There are several solutions available. Some of them are provided by javascript, some are free, and some are paid. In addition, some of them are server-side and some are client-side, but from this mail I think you need client-side solutions.
Client Side Discovery:
Modernizer -
The benefit of cool new web technologies is great fun, as long as you don't have to support browsers that are lagging behind. Modernizr makes it easy for you to write conditional JavaScript and CSS to handle each situation, whether the browser supports the function or not. Ideal for progressive improvement easily.
Good:
Client side only, server side component does not exist
Fast but still great for javascript framework with its 12kb. Due to its modularity, it can become smaller, depending on your needs.
Bad:
It can only do so much less information than server-side discovery.
Modernizr itself is a great way to find out about the capabilities of the user's browser. However, you can only access your API in the browser itself, which means that you cannot easily find out about the capabilities of the browser in your server logic.
Example:
<!DOCTYPE html> <html> <head> <meta charset="utf-8"> <title>Modernizr Example</title> <script src="modernizr.min.js"></script> </head> <body> <script> if (Modernizr.canvas) { </script> </body> </html>
JavaScript Bypass
It can be argued that this may be the (academically) worst way to detect mobile devices, but it has its merits.
Good:
Plain
Bad:
It will indicate only the type of device, but there will be no version of the device. For example, he will tell you that we used the iPad, but not if it is version 1.2 or 3.
Example:
<script type="text/javascript"> var agent = navigator.userAgent; var isWebkit = (agent.indexOf("AppleWebKit") > 0); var isIPad = (agent.indexOf("iPad") > 0); var isIOS = (agent.indexOf("iPhone") > 0 || agent.indexOf("iPod") > 0); var isAndroid = (agent.indexOf("Android") > 0); var isNewBlackBerry = (agent.indexOf("AppleWebKit") > 0 && agent.indexOf("BlackBerry") > 0); var isWebOS = (agent.indexOf("webOS") > 0); var isWindowsMobile = (agent.indexOf("IEMobile") > 0); var isSmallScreen = (screen.width < 767 || (isAndroid && screen.width < 1000)); var isUnknownMobile = (isWebkit && isSmallScreen); var isMobile = (isIOS || isAndroid || isNewBlackBerry || isWebOS || isWindowsMobile || isUnknownMobile); var isTablet = (isIPad || (isMobile && !isSmallScreen)); if ( isMobile && isSmallScreen && document.cookie.indexOf( "mobileFullSiteClicked=") < 0 ) mobileRedirect(); </script>
More details
I have another article / answer on this topic. Find HERE .