Reputation: 205
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.
Upvotes: 1
Views: 2288
Reputation: 2313
I think this may help you:
http://blog.grio.com/2012/07/uiwebview-javascript-to-objective-c-communication.html
Also check this thread out: http://blog.grio.com/2012/07/uiwebview-javascript-to-objective-c-communication.html
Upvotes: 1