Titanium Community Questions & Answer Archive

We felt that 6+ years of knowledge should not die so this is the Titanium Community Questions & Answer Archive

Change WebView <div> font size

Hello everyone!

Is there a way to change the font size of a specific div inside a WebView?

Most RSS Feed apps (e.g. NYTimes) have two buttons, the first increases the size of the fonts and the other one decreases it.

Thank you so much for your help!

— asked August 22nd 2010 by Savvas Panagiotidis
  • font
  • rss
  • size
  • webview
0 Comments

3 Answers

  • Accepted Answer

    On your web remote content

    <script type="text/javascript">
    function fontsize(size){document.getElementById("somecontent").style.fontSize  = size;}
    </script>
    

    on your app webview

    mywebview.addEventListener('load',function(){
    var font_size = 14
    mywebview.evalJS("fontsize('"+font_size+"px')");
    });
    
    — answered August 23rd 2010 by Daniel Lim
    permalink
    0 Comments
  • SlashGear application (made using Appcelerator) has a button for this, but i prefer it to be outside of the webview content area.

    — answered August 23rd 2010 by Savvas Panagiotidis
    permalink
    0 Comments
  • juste add a button event listener

    mybutton.addEventListener('load',function(){
    var font_size = 14
    mywebview.evalJS("fontsize('"+font_size+"px')");
    });

    — answered February 25th 2012 by guellai farid
    permalink
    0 Comments
The ownership of individual contributions to this community generated content is retained by the authors of their contributions.
All trademarks remain the property of the respective owner.