参考链接:https://github.com/xamarin/recipes/tree/master/Recipes/android/controls/webview/call_csharp_from_javascript 一.MainActivity中 //这个方法用于让H5调用android方法 web_view.AddJavascriptInterface(new JSXamarin(this), "JSXamarin"); 二.定义一个接口类: public class JS
前台方法: <script type="text/jscript"> var k = "test"; var s = '<%=ShowMsg(" ' + k + ' ")%>'; alert(s);</script> 后台方法: public string ShowMsg(string msg) { return msg;}