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!
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')"); });
-
SlashGear application (made using Appcelerator) has a button for this, but i prefer it to be outside of the webview content area.
-
juste add a button event listener
mybutton.addEventListener('load',function(){
var font_size = 14
mywebview.evalJS("fontsize('"+font_size+"px')");
});