开发者

javascript in android webview Problem?

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


You need to enable Javascript on your WebView.

webview.getSettings().setJavaScriptEnabled(true);
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜