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.

0

1 Answer 1

1

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

Sign up to request clarification or add additional context in comments.

3 Comments

Didn't help me. Javascript cannot be changed. But I've solved this issue in other way. In shouldStartLoadingWithRequest we can check if navigationType is FormSubmitted and get request.HTTPBody (where all parameters are stored)
inc could you elaborate more on how you did it ?
INC please help me to understand your solution in more detail. I am facing exact the same challenge while porting Android app to iOS app.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.