How To Apply Css Into Webview For Remote Html(url)?
I have a web page for example 'example.google.com/login?' I have loaded this url into the WebView using WebView.loadUrl() method. I have the css for this webpage and saved it in
Solution 1:
Had the same issue here, but worked around the issue! 1.) Cut out original CSS with JSOUP. 2.) Provide your costumized CSS thru your own webserver 3.) Add CSS entry with JSOUP Load the HTML in WebView with your own hosted CSS.
doc = Jsoup.connect(MyTaskParams.base_URL+MyTaskParams.sub_URL).get();
doc.head().getElementsByTag("link").remove();
doc.head().appendElement("link").attr("rel", "stylesheet").attr("type", "text/css").attr("href", "http://www.unden.at/zzzz/at.unden.android.screen.css");
Solution 2:
The WebView.loadUrl()
should give you an idea of what is happening in the method call.
You can load a page which has all the style code referenced from the page itself or within it as some inline or in page styles.
You can't load different Stylesheets from the assets folder for remote URL's because they come in as a Read-Only input stream, so there is not much you can do about it.
Post a Comment for "How To Apply Css Into Webview For Remote Html(url)?"