locked
Jquery detect type of device in all type of browser RRS feed

  • Question

  • User-893002196 posted

    Hi,

    Anyone have solution of Jquery to detect whether the device using in All type browser using Laptop, Normal LCD monitor or Tablet?

    if (navigator.userAgent.indexOf("Tablet PC") != -1) {

    } else {

    }

    This only work for IE & Edge. But, not others browser.

    Please advise.

    Thanks.

    Regards,

    Micheale

    Monday, December 23, 2019 10:40 AM

All replies

  • User-474980206 posted

    this is a fool's errand. There are literally thousands of users agent strings, and almost everyone has given up on using them for this purpose. You can determine some of the most common (apple iPad for example), but laptop vs desktop (no).

    what more commonly used now is feature detection, screen size, touch events, etc.

    but here is site you can use for reference:

      https://developers.whatismybrowser.com/useragents/explore/

    there currently have over 21 million agent strings defined.

    Monday, December 23, 2019 4:17 PM