1

In Android I can add javascript interface and retrieve a parameters from a WebView in a such way: For example I have javascript:

function showAndroidToast(toast) {
  Android.showToast(toast);
}  

And adding this interface I can retrieve parameters:

webView.addJavascriptInterface(new WebAppInterface(this), "Android");

 @JavascriptInterface
 public void showToast(String toast) {
     Toast.makeText(mContext, toast, Toast.LENGTH_SHORT).show();
 }

Is there any equivalent in iOS. I have a button that calls javascript. I need to get parameters on button click.

4

1 回答 1

1

我认为这可能会对您有所帮助:

http://blog.grio.com/2012/07/uiwebview-javascript-to-objective-c-communication.html

还要检查这个线程:http: //blog.grio.com/2012/07/uiwebview-javascript-to-objective-c-communication.html

于 2013-05-07T12:37:23.373 回答