Search
 
SCRIPT & CODE EXAMPLE
 

JAVASCRIPT

detect device ios or android javascript

function getOS() {
  var uA = navigator.userAgent || navigator.vendor || window.opera;
  if ((/iPad|iPhone|iPod/.test(uA) && !window.MSStream) || (uA.includes('Mac') && 'ontouchend' in document)) return 'iOS';

  var i, os = ['Windows', 'Android', 'Unix', 'Mac', 'Linux', 'BlackBerry'];
  for (i = 0; i < os.length; i++) if (new RegExp(os[i],'i').test(uA)) return os[i];
}
Comment

PREVIOUS NEXT
Code Example
Javascript :: javascript add event listener to all input 
Javascript :: turn object into string javascript 
Javascript :: express server how to get request ip 
Javascript :: Javascript track mouse pointer 
Javascript :: angular rebuild 
Javascript :: heroicons 
Javascript :: how to get element by attribute value in javascript 
Javascript :: check if parameter is array javascript 
Javascript :: javascript go back to last page 
Javascript :: window.onload 
Javascript :: array of A-Z 
Javascript :: document.ready 
Javascript :: jquery set select readonly 
Javascript :: add jquery to project 
Javascript :: select input by name javascript 
Javascript :: is email js 
Javascript :: Javascript detect mobile browser 
Javascript :: get text inside element javascript 
Javascript :: discord bot status javascript 
Javascript :: add select option javascript 
Javascript :: javascript password generator example 
Javascript :: how to find parent table of tr in jquery 
Javascript :: adding event on keypress in javascript 
Javascript :: js form submit listener 
Javascript :: Delete icon Mui 
Javascript :: javascript get current date jalali 
Javascript :: generate random numbers in js 
Javascript :: angular viewchild input element value 
Javascript :: react get screen width 
Javascript :: get button text javascript 
ADD CONTENT
Topic
Content
Source link
Name
7+5 =