HowTo fit text inside a UIWebView

If, like me, you want to make sure your text will fit inside your UIWebView (without scrolling), you can implement the following javascript:

    <script language='javascript' type="text/javascript">
    function adjustHeight(maxHeight) {
      elem = document.getElementById("sign");
      height = elem.offsetHeight;
      current_size = elem.style.fontSize.replace('px','')/1;
      while ((current_size-- > 10) && (height > maxHeight)){
        elem.style.fontSize = current_size + 'px';
        height = elem.offsetHeight;
      }
    }
    </script>

Continue reading HowTo fit text inside a UIWebView