Answers for "javascript get device"

1

get device type using javascript

const getDeviceType = () => {
  const ua = navigator.userAgent;
  if (/(tablet|ipad|playbook|silk)|(android(?!.*mobi))/i.test(ua)) {
    return "tablet";
  }
  if (
    /Mobile|iP(hone|od)|Android|BlackBerry|IEMobile|Kindle|Silk-Accelerated|(hpw|web)OS|Opera M(obi|ini)/.test(
      ua
    )
  ) {
    return "mobile";
  }
  return "desktop";
};
Posted by: Guest on July-05-2021
0

javascript get device

window.navigator.userAgent
Posted by: Guest on February-14-2021

Code answers related to "javascript get device"

Code answers related to "Javascript"

Browse Popular Code Answers by Language