6
我正在將代碼從Android轉換爲iPhone,下面是代碼在Android webview中從javascript中聽取「jb」。我如何在iPhone中實現代碼?使用iPhone的web界面的Javascript界面
webView.loadUrl(url);
webView.setWebViewClient(new AppWebViewClient());
webView.addJavascriptInterface(new JavascriptBridge(), "jb");
final class JavascriptBridge
{
public void callback(String param){
//Generate the returnValue from the bridge
/*
String toastValue = param
Toast toast = Toast.makeText(AppHelp.this, toastValue, Toast.LENGTH_LONG);
toast.show();
*/
Log.i(TAG, param);
if (param.equals("close")) {
AppHelp.this.finish();
}
}
}
你有沒有找到任何方式來實現在iOS? iOS中JavascriptInterface的替代方法? – harshit2811 2015-07-22 09:51:32