kris14an
kris14an

Reputation: 751

Android WebView loadUrl and add Script

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 ?

Upvotes: 1

Views: 419

Answers (1)

Chirag Ghori
Chirag Ghori

Reputation: 4231

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..

Upvotes: 2

Related Questions