Answers for "get mobile and ipad and tablet javascript"

2

js if mobile browser

// credit to Timothy Huang for this regex test: 
// https://dev.to/timhuang/a-simple-way-to-detect-if-browser-is-on-a-mobile-device-with-javascript-44j3
if(/Android|webOS|iPhone|iPad|iPod|BlackBerry|IEMobile|Opera Mini/i.test(navigator.userAgent)){
  return true
}
else{
  return false
}
Posted by: Guest on November-24-2020
2

how to detect device javascirpt

if( /Android|webOS|iPhone|iPad|iPod|BlackBerry|IEMobile|Opera Mini/i.test(navigator.userAgent) ) {
 // some code..
}
Posted by: Guest on July-02-2020

Code answers related to "get mobile and ipad and tablet javascript"

Code answers related to "Javascript"

Browse Popular Code Answers by Language