开发者

javascript in android webview Problem?

开发者 https://www.devze.com 2023-03-29 04:51 出处:网络
I have problem with load javascript with html in webview below is my code it won\'t be able to load the view..

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

精彩评论

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