javascript - How to load js and css files from Assets folder with a string html in the Android Webview? -
how load js , css files custom html in android webview? here code snip below, image loading. code works on server. removing "file:///android_asset/" doesn't work too. files in "assets/katex". please help!
//ria
s.setjavascriptenabled(true );
// stringbuilder sb = new stringbuilder(); string customhtml = "<html><head>" + "<link rel=\"stylesheet\" type=\"text/css\" href=\"file:///android_asset/katex/katex.min.css\">" + "<script type=\"text/javascript\" src=\"file:///android_asset/katex/katex.min.js\"></script>" + "</head><body>" + "<script> alert(\"hey!\") </script>" + "<span class=\"q1\">x^2-xy+3y^2 = 15</span>" + "<p><img src=\"file:///android_asset/katex/image1.jpg\" /></p>" + "</body>" + "<script type=\"text/javascript\" src=\"file:///android_asset/katex/scrpt.js\"></script>" + "</html>"; webview.loaddatawithbaseurl("file:///android_asset/" , customhtml, "text/html" , "utf-8" , "");
Comments
Post a Comment