Kira Kira - 1 year ago 85
Javascript Question

Touch tester does not detect touch events in firefox and ie11

I found this fiddle to test touch support in my browser.

$(document).on("touchstart touchmove touchend touchcancel", function(ev) {
$.each(ev.originalEvent.touches, function (i, t) { logtouch(ev.type + "-touches", t); });
$.each(ev.originalEvent.changedTouches, function (i, t) { logtouch(ev.type + "-changed", t); });
$.each(ev.originalEvent.targetTouches, function (i, t) { logtouch(ev.type + "-target", t); });

I have removed mousemove, mouseclick, mousedown and mouseup events in above link so I can test touch events without any interference from other events

Above fiddle displays some text in chrome but does not have any effect in Mozilla firefox and IE11.

MDN link for touch support:

I have also tried the above MDN link but there is no trace of touch events triggering in the fiddle

When I checked, the support table shows firefox in red with a flag. But the MDN link does not mention any.

Is there any way to identify multi-touch in firefox and ie11. Because I am adding pinching support for my widget. I am not sure how to identify multi-touch in these browsers.

Firefox version is 47.0.1

Answer Source

IE11 supports pointer events. Pointer events handle all types of input (touch, mouse, pen, etc.,).

Firefox does not support multi-touch officially yet (at the time of writing this answer). But we can test touch interactions using their nightly builds. By default Pointer Events and touch events are disabled in nightly. We should enable them through about:config page

Note: Changing settings using about:config might void your warranty so do it at your own risk