hammerjs / hammer.js

A javascript library for multi-touch gestures :// You can touch this
http://hammerjs.github.io
MIT License
23.99k stars 2.63k forks source link

Hammer.js not working from embedded c# WebBrowser #1020

Open Eirik- opened 7 years ago

Eirik- commented 7 years ago

It seems that Hammer.js events doesn't work in embedded c# Forms WebBrowser (tested using mouse). I have tested embedding the example page http://hammerjs.github.io/#try-it - and nothing seem to work! I use Hammerjs in my application, and a customer wants to embed it using the c# browser.

When I use addEventListener for 'mouseup' (and similar ) it seems to work, so I don't know why hammer does not.

Any ideas on where things go wrong?

arschmitz commented 7 years ago

@Eirik- Sorry i dont know much if anything about the .net embeded web browser or .net in general though a quick google search seems to indicate that it is not a full featured browser as everyone seems to be looking to replace it with a "full featured standards compliant browser" i couldn't even find what the rendering engine for it is ( maybe trident, maybe edge, or something else? ) you might start by trying to use one of the many open source projects which allow you to to use chromium in your .net app instead?

Eirik- commented 7 years ago

@arschmitz Yes, the .net embedded browser appears to use the built in IE on the client (which in my case should be IE11), not sure why not everything is working though. I have recommended using chromium, but it is not certain that the customer can change the implementation - but, hopefully they can.

Eirik- commented 7 years ago

@arschmitz We found a solution! It appears the embedded .net browser will by default have legacy input mode enabled. This could be disabled by setting the registry key FEATURE_NINPUT_LEGACYMODE to 0.

be-hel commented 7 years ago

I had the same problem, but since FEATURE_NINPUT_LEGACYMODE does not work on windows 7 (it works on windows 8 and 10 though), I investigated further.

The root cause is that Hammer.js use window.MSPointerEvent to check for MSPointerEvent-Capabilities. This works in most cases, but not when using an embedded IE browser. For the embedded browser window.MSPointerEvent exists but is not enabled (sigh). The correct check is window.navigator.msPointerEnabled (see https://msdn.microsoft.com/library/hh673557(v=vs.85).aspx ). Using that check it works.

Is it possible to fix?

domschmidt commented 7 years ago

Could you please have a look if this issue can be fixed soon?

Please find a demo application with a simple WebControl Browser component here: http://www.provisio.com/Download/Webbrowser%20Control%20Test%20Applikation%20DE.pdf

Directlink: http://www.provisio.com/Download/beta/WebbrowserTestApplication.zip

thank you

pwaltherimc commented 7 years ago

Hi there. I also need a fix for this error really soon cause my application is not working properly cause of this error. Could you fix this?

Thanks.

Best, Patrick

domschmidt commented 7 years ago

image

gothge commented 7 years ago

There is no way hence M$ is no longer maintaining windows 7. But there is a bad fix: rename your app to "iexplore.exe" on windows 7 and enjoy the magic.