[JS] Detect Mobile Devices Sử dụng JS

While I understand and value the concept of feature detection over browser detection, sometimes the need for knowing whether or not we’re dealing with a mobile device arises.  For in-depth device checking, you can rely on a complex library such as The MobileESP Project.  But for simpler applications, the following snippet can be useful.

While this doesn’t account for all mobile platforms, it will pick up the most popular ones out there.


To check to see if the user is on any of the supported mobile devices:

To check to see if the user is on a specific mobile device:

Internet Resource



No comments yet.

Please Post Your Comments & Reviews

Your email address will not be published. Required fields are marked *