title: How to handle Javascript onorientationchange event inside uiwebview
body: <p>Anyone could help me how to handle orientation change event in Javascript when visiting through <code>uiwebview</code> in iPhone?</p>
  <p>I am trying to capture <code>onorientationchange</code> event of Javascript. I tried following code:</p>
  <pre><code>&lt;style type=&quot;text/css&quot; media=&quot;only screen and (max-device-width: 480px)&quot;&gt;
      .portrait
      {
          width: 300px;
          padding: 0 15px 0 5px;
      }
      .landscape
      {
          width: 460px;
          padding: 0 15px 0 5px;
      }
  &lt;/style&gt;
  
  &lt;script type=&quot;text/javascript&quot;&gt;
      window.onload = orientationchange;
      window.onorientationchange = orientationchange;
      function orientationchange() {
          if (window.orientation == 90
              || window.orientation == -90) {
              document.getElementById('contents').className = 'landscape';
          }
          else {
              document.getElementById('contents').className = 'portrait';
          }
      }
  &lt;/script&gt;
  
  // and I have a div inside html
  
  &lt;div id=&quot;contents&quot;&gt;
      my contents and description... e.t.c, and e.t.c...
  &lt;/div&gt;
  </code></pre>
  <p>It works fine in safari but when I visit the page using <code>uiwebview</code> the orientation change event is not being captured and my desired functionality could not being achieved.</p>