0

I have problem with load javascript with html in webview below is my code it won't be able to load the view..

String strHtml="<html>"
            +"<head>"        
            +"<title>My Title</title>"    
            +"<script type=\"text/javascript\" src=\"file://android_asset/Test/Demo.js\"></script>"
            +"</script>"
            +"</head>"   
            +"<body>"     
            +"<div id=\"chartContainer\">Test Demo!</div>"          
            +"<script type=\"text/javascript\">"
            +"FusionCharts.setCurrentRenderer('javascript');"
            +"var myChart = FusionCharts.render( \"file://android_asset/Demo/Demo.swf\", \"myId\", \"280\", \"360\", \"Container\", \"file://android_asset/Data.xml\" );"
            +"</script>"
            +"</body>" 
            +"</html>";

webview.loadData(strHtml, "text/html", "utf-8");

If possible Please provide the solution with an example or if I made mistake let me know

1 Answer 1

8

You need to enable Javascript on your WebView.

webview.getSettings().setJavaScriptEnabled(true);
Sign up to request clarification or add additional context in comments.

Comments

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.