模仿微信webview的JsBridge
jopen
10年前
模仿微信webview的JsBridge,安全方便的实现js和Java的互相调用,主要通过loadUrl和shouldOverrideUrl实现
WebViewJavascriptBridge.registerHandler("functionInJs", function(data, responseCallback) { document.getElementById("show").innerHTML = ("data from Java: = " + data); var responseData = "Javascript Says Right back aka!"; responseCallback(responseData); });
项目主页:http://www.open-open.com/lib/view/home/1425194965843