IOS/Android - check the user agent to see if the browser is IOS or Android?

function isAppleDevice(){
    return (
      (navigator.userAgent.toLowerCase().indexOf("ipad") > -1) ||
      (navigator.userAgent.toLowerCase().indexOf("iphone") > -1) ||
      (navigator.userAgent.toLowerCase().indexOf("ipod") > -1)
   );
  }

$(document).ready(function() {

  var isAndroid = navigator.userAgent.toLowerCase().indexOf("android");
  var isiPhone = navigator.userAgent.toLowerCase().indexOf("iphone");
  var isiPad = navigator.userAgent.toLowerCase().indexOf("ipad");
  var isiPod = navigator.userAgent.toLowerCase().indexOf("ipod");
 
  if(isiPhone > -1) {
    //iPhone Version
  }
  if(isiPad > -1) {
    // iPad Version.
  }
  if(isiPod > -1) {
    // iPod Version.
  }

  if(isAndroid > -1) {
    $('body').addClass('android');      
  }
  else if( isAppleDevice() ) {
    $('body').addClass('ios');
  }

});
 

Tags

Instagram Without API

Could not reach Instagram server