'Disable hover event in WKWebView on iPadOS while using mouse

As you may know, you can use Magic Mouse or Trackpad with your iPad since iPadOS 14 and hover events in Safari and WKWebView are handled as in desktop operating systems. My question is, is there any way to disable this behavior? I'm trying to load any website into WKWebView and it is required to have the same behavior as on iPhone (no hover at all), even if I use Magic Mouse. Maybe you have had the same problem in your career and have some solution? I think it could be done using JavaScript injection while loading, but I don't know exactly which JS code should I use, or maybe there are some configurations for that in WKWebView?



Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source