Ol3 With Ie11 In A C# Webbrowser Control Mouse Click Events Not Working
Solution 1:
I know this is a bit of a late post, but hopefully it might help others if they stumble across it.
I was in exactly the same boat: using a WebBrowser control with compatibility set to IE11 was causing OpenLayers 3 to ignore mouse button clicks when displaying 2D maps. I tried CefSharp 3, and sure enough it resolves the problem, but there are other reasons why that can't be used for me. After lots of trial and error, I stumbled across this as a workable solution:
<metahttp-equiv="X-UA-Compatible"content="IE=11" /><script>if (navigator.appVersion.indexOf("MSIE 7.") !== -1)
{
deletewindow.PointerEvent;
window.navigator.msPointerEnabled = false;
}
</script>
This needs to be on the page before the inclusion of ol.js.
It's a crude test of whether the page is running in a WebBrowser control admittedly, but should suffice now that IE7 is no longer supported. The only real instance of "MSIE 7." in the user agent string will be from a default WebBrowser control.
I've not found any other OpenLayers problems as yet.
Solution 2:
So, I decided to roll back to IE10. Everything works in both the native browser and in the WebBrowser control.
IE11 breaks too much stuff, and isn't worth the "upgrade" at this point in time.
I will be checking out CefSharp in the future, just not enough time to put into upcoming release.
Solution 3:
I was in the same situation than you a few months ago. The non working mouse events, are just the first symptom. I strongly recommend you to use Chromium for that, because at the end, you are not using an IE11 (Webbrowser control is based on a IE9 kernel), and you just can influence "a bit" how it works, BUT: if you have a complex problem you have no way to really update your browser, to debug, etc. Chromium works really fine and you can embed it completely in your solution, star it separately to debug or test, and it's based on a modern chrome. To integrate it on a .net solution, you can use:
https://github.com/cefsharp/CefSharp
Regards
Solution 4:
The problem is related to the legacy input model, which is enabled by default for WebBrowser Controls hosted by an application.
To get your OpenLayers3 application working you have to disable it in the registry. To do this you have to set FEATURE_NINPUT_LEGACYMODE
to 0
for your application. If this key doesn't exist in your FeatureControl
branch, you have to create it manually.
For more information about the legacy input model read this.
Solution 5:
I had a lot of issues with ol3 / WebBrowser in winforms, like a lot of features not working well; After I added this in the HTML header, it was perfect :
<head><metahttp-equiv="X-UA-Compatible"content="IE=10,chrome=1" />
Post a Comment for "Ol3 With Ie11 In A C# Webbrowser Control Mouse Click Events Not Working"