Languages

Menu
Sites
Language
How to use AddJavaScriptMessageHandler?

How to use AddJavaScriptMessageHandler of webview to send message from JavaScript?

c#

try
{
    this.control = (T.WebView)this.NativeView;
    if (this.control != null)
    {
        bool bok = this.control.AddJavaScriptMessageHandler("test", new T.JavaScriptMessageHandler(this.OnJavaScriptCall));
        System.Diagnostics.Debug.WriteLine(bok);

    }
    
}
catch
{
}

JavaScript:

<script type="text/javascript">
    alert(test);
</script>

test is null on Html.... who can help me?

Responses

1 Replies
Armaan-Ul- Islam

You can only check the API Documentations for Xamarin.Forms as Tizen.NET Supports Xamarin.Forms only.

This guide seemed relevant:

https://developer.xamarin.com/guides/xamarin-forms/user-interface/webview/

Along with samples for webview:

https://developer.xamarin.com/samples/xamarin-forms/WorkingWithWebview/

Check Xamarin.Forms Section only.