title: How do I add iPhone / iPad detection using Javascript?
body: <p>I want to add a condition on my website if the browser is from iPhone/iPad to have some specific behavior like when a button is clicked to display a div.</p>
  
  <p>Something like : </p>
  
  <pre><code>&lt;script type="text/javascript"&gt;
  /* iPhone scripts */
  &lt;?php if(strstr($_SERVER['HTTP_USER_AGENT'],'iPhone') || strstr($_SERVER['HTTP_USER_AGENT'],'iPod')){ ?&gt;
      // window.addEventListener("load",function() {
      // setTimeout(function(){
      // window.scrollTo(0, 1);
      // }, 0);
      // });
     jQuery(document).ready(function() {
  }
  });
  </code></pre>
  
  <p>
  
  This is just what I've found but I'm not sure this is the way to do it. </p>