Search code examples
xamarinxamarin.formswebviewxamarin.androidxamarin.ios

Call c# function from javascript in Xamarin.Forms Webview


I want to make call of some c# code when user tap on a button in html. I followed below example and also tried it and it is working for my purpose if i use it as it is.

https://learn.microsoft.com/en-us/xamarin/xamarin-forms/app-fundamentals/custom-renderer/hybridwebview

It uses index.html from assets, instead i want to use some URL where my html page is. But unfortunately when i change url, it stops invoking c# code.

Please let me know if there are any changes needed to get it working.


Solution

  • It was some firewall settings blocking communication from my iOS simulator, got it fix after adding certificate.

    Example demo is working fine now