In WebView2 browser, I want to move things with finger. But it does not support ontouchxxx(ontouchstart, ontouchend). In other word, "ontouchend" in document returns false.
I tried various ways as followings but it doesn t work.
webView2 = new Microsoft.Web.WebView2.WinForms.WebView2();
- setTouchEmulationEnabled
await webView2.EnsureCoreWebView2Async(null);
if (webView2.CoreWebView2 != null)
{
webView2.CoreWebView2.CallDevToolsProtocolMethodAsync("Emulation.setEmitTouchEventsForMouse", "{ enabled : true }");
}
- --enable-features=msWebView2EnableDraggableRegions
string arg = @"--enable-features=""msWebView2EnableDraggableRegions""";
var opts = new CoreWebView2EnvironmentOptions { AdditionalBrowserArguments = arg };
var webView2Environment = await CoreWebView2Environment.CreateAsync(null, null, opts);
await webView21.EnsureCoreWebView2Async(webView2Environment);
- IsSwipeNavigationEnabled
await webView2.EnsureCoreWebView2Async(null);
if (webView2.CoreWebView2 != null)
{
webView2.CoreWebView2.Settings.IsSwipeNavigationEnabled = true;
}
- Change UserAgent like iPad emulator of chrome,edge which return true for "ontouchend" in document
await webView2.EnsureCoreWebView2Async(null);
if (webView2.CoreWebView2 != null)
{
webView2.CoreWebView2.Settings.UserAgent = "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/16.0 Safari/605.1.15";
}