1

How can I add my Script to loaded code from URL? I try to use AsyncTask, send http request and set code to WebView, but then is not loading images and page dosn't work well.

        @Override
    protected void onPostExecute(String result) {
        webView.loadData( result, "text/html", "UTF-8" );
    }

I doing something wrong ?

1
  • i think loadDataWithBaseURL is better when you try to load webview data with Script at runtime .. Commented Jan 19, 2014 at 12:42

1 Answer 1

2

If you want to run html file runtime then try using this code.

 webView.loadDataWithBaseURL("file:///android_asset/", result, "text/html", "UTF-8",null);

And make sure if you want to use any css or javascript file then put it into android assest folder..

Sign up to request clarification or add additional context in comments.

1 Comment

ok, but i want to open URL from http, not file. When i do like your answer, must download, css, script, image and other files.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.