How I can call a javascript function with MonoTouch and vice versa?

To invoke Javascript code running in the UIWebView from your application, use the EvaluateJavascript method, like this: myView. EvaluateJavaScript ("a = 1;") To call back into your C# code, the only option is to hook up to the ShouldStartLoad property like this: myView. ShouldStartLoad = myHandler; ... bool myHandler (UIWebView webView, NSUrlRequest request, UIWebViewNavigationType navType) { // Determine what to do here based on the @request and @navType } You can of course, also use anonymous methods if you want to access local variables easily: myView.

ShouldStartLoad = (webView, request, navType) => { // Determine here what to do } In the Javascript side, if you want to call back to Mono, you then set the location. Href property to a "special" url, like this: Javascript code: location. Href = "myapp://action?

Par1=abc&par2=def The information will be available on the request object: request.Url.AbsoluteString.

To invoke Javascript code running in the UIWebView from your application, use the EvaluateJavascript method, like this: myView. EvaluateJavaScript ("a = 1;"); To call back into your C# code, the only option is to hook up to the ShouldStartLoad property like this: myView. ShouldStartLoad = myHandler; ... bool myHandler (UIWebView webView, NSUrlRequest request, UIWebViewNavigationType navType) { // Determine what to do here based on the @request and @navType } You can of course, also use anonymous methods if you want to access local variables easily: myView.

ShouldStartLoad = (webView, request, navType) => { // Determine here what to do } In the Javascript side, if you want to call back to Mono, you then set the location. Href property to a "special" url, like this: // Javascript code: location. Href = "myapp://action?

Par1=abc&par2=def" The information will be available on the request object: request.Url.AbsoluteString.

Thanks, Miguel! A million times, thanks! This just answered my question as well... my question is here: stackoverflow.Com/questions/5404152/….

I am busy building a bridging mechanism for two-way communication between javascript and monotouch and have been struggling with implementing ShouldStartLoad delegate. This gave me the info that I needed to get it working. :) :) :) – Brucell Mar 23 at 15:15 thanks Miguel, you are the best!

– user672206 Mar 23 at 15:59.

I haven't tried it in monotouch, but it should be the same as in ObjC: UIWebView. EvaluateJavascript.

WebClient and SOAP calls lock up in MonoTouch 4.0.0 and 4.0.1. Works in 3.2.6. What's causing it?

I cant really gove you an answer,but what I can give you is a way to a solution, that is you have to find the anglde that you relate to or peaks your interest. A good paper is one that people get drawn into because it reaches them ln some way.As for me WW11 to me, I think of the holocaust and the effect it had on the survivors, their families and those who stood by and did nothing until it was too late.

Related Questions