Friday, 22 November 2019

Xamarin WebView - Can't Disable Double Click Event

I'm trying to disable any double clicking functionality from happening, in this case, to disable the functionality of double clicking an instagram image to like it. I have tested some JavaScript as a chrome extension, and it gives me the results I am looking for, but when I bring it into a Xamarin WebView, it doesn't work. What's weird is that the injected JavaScript is being ran, because if I have an alert inside of it, it's displayed. It's just still liking the image on Instagram.

This is the JavaScript for the Chrome Extension

document.addEventListener("dblclick",handler,true);function handler(e) {
    e.stopPropagation();
    e.preventDefault(); }

And this is the code for Xamarin

  string function = "document.addEventListener(\"dblclick\",handler,true);function handler(e){e.stopPropagation();e.preventDefault();}";
  Xamarin.Forms.Device.BeginInvokeOnMainThread(() => { webBrowser.Eval(function); }); 


from Xamarin WebView - Can't Disable Double Click Event

No comments:

Post a Comment