megamind11
megamind11

Reputation: 97

Loading javascript online in a local html file in a webview?

i have a html file saved in my internal memory which i am loading in my android webview,but i want to load the javascript from the internet.

Following is the code. My first chart using FusionCharts Suite XT

    </script>
    </head>
    <body>

    <div id="chartContainer">FusionCharts XT will load here!</div>
    </body>
    </html>

but the js file is not loading.Is this way correct?

Upvotes: 1

Views: 784

Answers (1)

You have to enable javascript inside your webview. Do this inside your onCreate method, on the class you use your webview:

    wv = (WebView) findViewById(R.id.WEBVIEWNAMEINYOURXML);
    wv.getSettings().setDomStorageEnabled(true);
    wv.getSettings().setJavaScriptEnabled(true);

Where you substitute WEBVIEWNAMEINYOURXML by the name of your webview inside your layout xml.

Upvotes: 1

Related Questions