How to evaluate javascript in Xamarin.Android/Monodroid and retrieve result?

For Xamarin.iOS/Monotouch it is simple to retrieve a string when evaluating javascript.

e.g.

string elementValue = browser.EvaluateJavascript("document.getElementById('Id').value");

if(elementValue != "")
{
DoSomething();
}
Could anybody provide an example of how to do this for Xamarin. Android/Monodroid (both pre-kitkat (using loadURL(javascript:)) and kitkat (using evaluatejavascript))?

I did not know how to setup a IValueCallback (for evaluatejavascript in KitKat) and I did not know how to have the string return using a javascriptinterface before the next line is called (pre-KitKat).

Posts

Sign In or Register to comment.