Do desktop browsers support touch events?

It's actually the other way round. Mobile browsers translate touch to mouse events for legacy support. If it needs to work on both mobile and desktop, and you don't really need touch events, you could just use mouse events instead. Failing that, bind both touch and mouse events and have the touch event cancel the mouse event. This way on mobile devices the touch fires and mouse doesn't. On desktop the touch doesn't fire and the mouse will.

For pilau, here's a simple example of cancelling the click event on mobile devices. Please note the question is more about drawing which would involve click dragging, which would require a bit more code for detection, but the basic idea is the same, bind the events you need to handle. Then e.preventdefault() will stop the mobile browsers from emulating click type events.

$('#element').on('touchend click', function(e){

   // Do your onclick action now

   // cancel the onclick firing
   e.preventDefault();
});

Firefox 6 and above supports the touch events. See the compatibility table here.

MDN article on Touch Events

EDIT : Are you testing with a touchscreen or the mouse? The mouse events do not automatically translate to touch events. See this post for how to simulate touch events with a mouse.

Tags:

Html

Touch