Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 9122307
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 17, 20262026-06-17T06:04:19+00:00 2026-06-17T06:04:19+00:00

WebView web_view = (WebView) findViewById(R.id.webView1); web_view.getSettings().setJavaScriptEnabled(true); web_view.getSettings().setPluginsEnabled(true); web_view.getSettings().setAllowFileAccess(true); String data; data = <?xml version=\1.0\

  • 0
WebView web_view = (WebView) findViewById(R.id.webView1);
        web_view.getSettings().setJavaScriptEnabled(true);
        web_view.getSettings().setPluginsEnabled(true);
        web_view.getSettings().setAllowFileAccess(true);

        String data;
        data = "<?xml version=\"1.0\" encoding=\"UTF-8\" ?>"
                + "<html>"
                + "<head>"
                + "<title>My First chart using FusionCharts XT</title>"
                + "<script type=\"text/javascript\" src=\"FusionCharts.js\">"
                + "</script>"
                + "</head>"
                + "<body>"
                + "<div id=\"chartContainer\">FusionCharts XT will load here!</div>"
                + "<script type=\"text/javascript\">"
                + "FusionCharts.setCurrentRenderer(\"javascript\");"
                + "var myChart = new FusionCharts(\"FusionCharts/Line.swf\", \"myChartId\", \"400\", \"300\", \"0\", \"1\" );"
                + "var dataString =\"<chart> <set label='0.00' value='0'/><set label='5.00' value='2' /><set label='7.00' value='3' /><set label='9.00' value='4' /><set label='12.00' value='2' /></chart>\"; "
                + "myChart.setXMLData(dataString);"
                + "myChart.render(\"chartContainer\");" + "</script>"
                + "</body>" + "</html>";

        Log.i("info", "Html " + data);

        web_view.loadData(data, "text/html; charset=UTF-8",null);

In my project i am using fusion charts. I am making a html string data and load it in WebView as in above code sample. When i run this html file in browser it runs and make me Fusion charts, But when i am doing this with for android Web view it is not loading in my Web View.
I have already Enable javascript.
I paste javascript file in to assets folder.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-17T06:04:21+00:00Added an answer on June 17, 2026 at 6:04 am

    First of all, the browser you mentioned is a browser on your device or is it a browser in a computer?

    Now, if it worked in the android browser (or a browser in your device), then the problem is because the javascript files are on your assets folder. When you indicate a resource through relative path (the way you are using), the webview searchs it relative to the same folder as your html file is. Since you are using a String as your “html file”, I would recommend using the loadDataWithBaseURL(). I made an usage example below using the assets folder as the base URL, try it.

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

    public void loadDataWithBaseURL (String baseUrl, String data, String mimeType, String encoding, String historyUrl)

    Added in API level 1
    Loads the given data into this WebView, using baseUrl as the base URL for the content. The base URL is used both to resolve relative URLs and when applying JavaScript’s same origin policy. The historyUrl is used for the history entry.

    Note that content specified in this way can access local device files (via ‘file’ scheme URLs) only if baseUrl specifies a scheme other than ‘http’, ‘https’, ‘ftp’, ‘ftps’, ‘about’ or ‘javascript’.

    If the base URL uses the data scheme, this method is equivalent to calling loadData() and the historyUrl is ignored.

    Parameters
    baseUrl the URL to use as the page’s base URL. If null defaults to ‘about:blank’.
    data a String of data in the given encoding
    mimeType the MIMEType of the data, e.g. ‘text/html’. If null, defaults to ‘text/html’.
    encoding the encoding of the data
    historyUrl the URL to use as the history entry. If null defaults to ‘about:blank’.

    You can try passing the assets folder as the baseUrl, so my guess would be that your code would be like this

    Hope this helps!

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have the following code in my activity: browser = (WebView)findViewById(R.id.webkit); browser.getSettings().setJavaScriptEnabled(true); browser.getSettings().setPluginsEnabled(true); browser.getSettings().setDomStorageEnabled(true);
WebView myWebView = (WebView) findViewById(R.id.webview); WebSettings webSettings = myWebView.getSettings(); webSettings.setJavaScriptEnabled(true); webSettings.setPluginsEnabled(true); myWebView.loadUrl(file:///android_asset/index.html); myWebView.loadUrl(javascript:hello()); It
public class WeeklyInspection : Activity { WebView view = (WebView) FindViewById(Resource.Id.inspectionWV); view.Settings.JavaScriptEnabled = true;
I am loading url into webview: WebView webview=(WebView)findViewById(R.id.webview); webview.loadUrl(url); It's taking some time to
I'm trying to set the URL for a WebView from the layout main.xml. By
I am using a webview and on that web view i have a image.
I add webview and navigationbar inside my view controller . Web view is display
I did one sample application using WebView, in that web view the URL comes
How can I stop a YouTube video which is played in my webview? When
How can I change content language in my WebView. My exampe (below) works good,

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.