title: jquery detect phone orientation
body: <p>I have some code I wrote that alerts the user on mobile phones that change to landscape to basically go to portrait. This works great but if the user starts off in landscape it obviously doesnt show since there is no orientation change. Is there a way to just get the orientation of the get go?</p>
  
  <pre><code>$(window).on("orientationchange",function(){
          if( (window.orientation == 90 &amp;&amp; $( window ).width() &lt; 780) || (window.orientation == -90 &amp;&amp; $( window ).width() &lt; 780) ) // Landscape
          {
            $('body').append('&lt;div class="phoneLandscape"&gt;&lt;h4&gt;Sorry, this site is best viewed in Portrait Mode&lt;/h4&gt;&lt;/div&gt;');
          }
          else // Portrait
          {
            $('.phoneLandscape').remove();
          }
        });
  </code></pre>