title: Javascript Alert on mobile devices based orientation
body: <p>I'm trying to alert mobile device users on my site to use their devices in landscape mode. I have an alert pop up but it seems to be getting caught in an infinite loop. How would I go about stopping that loop after the user has clicked ok?</p>
  
  <p>Here is the code:</p>
  
  <pre><code>window.ondeviceorientation = detectIPadOrientation;
  function detectIPadOrientation () 
  {
      if ( orientation == 0 || orientation == 180 ){
          alert ('Please use your iPad in landscape mode'); 
      }
  }
  </code></pre>