I am working on developing iOS application using Xamarin. I have a requirement to call c# method from JavaScript inside UIWebView. How could we achieve that?
The following is html content is loading into UIWebView
const string html = @"
<html>
<body onload=""setBarcodeInTextField()"">
<p>Demo calling C# from JavaScript</p>
<button type=""button""
onClick=""CSharp.ScanBarcode('txtBarcode', 'setBarcodeInTextField')"">Scan Barcode
</button>
<input type=""text"" value="""" id=""txtBarcode""/>
<script type=""text/javascript"">
function setBarcodeInTextField() {
alert(""JS"");
}
</script>
</body>
</html>";
Also, i am getting about://(null) in alert message (onload specified on body tag for displaying alert) when UIWebView loads the html content.