0

I'm using a Xamarin.Forms WebView to bind in a HTML webpage in my App. Now i need to execute some code within my App when a specific button in that HTML page ist clicked.

I have seen a few approaches for Android WebViews but i cant transfer it to Xamarin.Forms.

Example: How to catch element click by ID in Android webview?

user132397
  • 61
  • 1
  • 5
  • You can use the plugin FormsWebview, which allows the callback to c# code from javascript. You can intercept this callback and execute your logic then. Plugin: https://github.com/SKLn-Rad/Xam.Plugin.Webview – Sparsha Bhattarai May 20 '19 at 14:35
  • Based on your description, do you want to achieve a hybird webview in your application like this link? https://xamarinexplorer.com/2017/12/30/handle-button-click-event-xamarin-webview/ , If so, you should achieved by `custom renderer` – Leon May 21 '19 at 07:08
  • Lets say i have a WebView with google as contentpage. Now i want to write "This is a test" in Console when the search button is clicked. If someone could give me sample code for this simple example I will be able to transfer it to my usecase. – user132397 May 21 '19 at 10:12
  • You can refer to this link https://stackoverflow.com/a/45644422/10627299, he achieve it with `XLabs.Forms.Controls.HybridWebView` – Leon May 22 '19 at 09:25

0 Answers0