Tuesday 15 April 2014

javascript - is there a way to apply css or java script in a "web view" in android? -


Here is the code that I have used to remove the source code of a website and I need to remove some part of it , And show it in the Android webview.

In this code I saved the source in a string called "source code" and I want to load this HTML code in my web view; It works, but it does not apply to any CSS or Java scripts.

Is there any way to implement them?

  protected void onCreate (bundled saved instenstate) {super .onCreate (savedInstanceState); SetContentView (R.layout.main); Webview wb = (webview) Find VVBID (R.D.weeb Wi1); Last string mime type = "text / html"; Final String Encoding = "UTF-8"; String HTML = "problem with loading page "; // Here I have used the "getUrlSource ()" method which I have written string source = ""; Try {SourceCode = getUrlSource ("http://www.nerkh.co"); } Grip (IOException E) {// TODO Auto-Generated Catch Block e.printStackTrace (); Wb.loadDataWithBaseURL ("", html, mime type, encoding, ""); } Wb.loadData (sourceCode, mimetype, encoding);    

have you enabled javascript for your webview

webview.getSettings (). SetJavaScriptEnabled (true); ?

CSS and Javascript should be searched only for cached webpages.
For referencing CSS / JS though you may need internet connection to load the files.
I suspect that the method getUrlSource . Something is wrong with

No comments:

Post a Comment