3

I'm building a touchscreen kiosk using Chrome (7.0.536.2 dev) in kiosk mode on a Windows 7 PC with multi-touch display.

I can see that the ontouchstart event is available (by inspecting the window object in Webkit Web Inspector) but it never fires. If I write the following code, the onclick event fires when I touch the screen but the ontouchstart event doesn't.

window.onclick = function() { alert("click"); }
window.ontouchstart = function() { alert("touchstart"); }

In Firefox 4 the MozTouchDown event fires without any problems.

Are these events not yet available to JavaScript?

Brian Tompsett - 汤莱恩
  • 5,753
  • 72
  • 57
  • 129
Nick Boyce
  • 295
  • 5
  • 11

3 Answers3

0

as of chrome 20, you can enable touch events from the "about://flags" internal experiments webpage

I did notice that this breaks fastClick, if you're using that - I was :)

mmaclaurin
  • 1,412
  • 1
  • 13
  • 18
0

I experienced this when developing an iPad webapp and tried to test it in Chrome. It turned out, that Chrome recognizes those events, but does not fire them at the moment. This is a bit frustrating, since it breaks support detection in JavaScript.

jwueller
  • 30,582
  • 4
  • 66
  • 70
  • Thanks for the quick reply. It's extremely frustrating, but I guess all I can do is wait for these touch events to become available to JavaScript in Chrome. – Nick Boyce Oct 07 '10 at 11:19
0

There is a command-line switch to enable touch events, change your shortcut adding "chrome.exe --enable-touch". Unfortunately, if ('ontouchstart' in window) returns true then, event is never fired. Just tested this on a Windows7 touch-enabled tablet on canary channel. Disappointing... !

Olivier
  • 3,431
  • 5
  • 39
  • 56