7
rated 0 times
[
9]
[
2]
/ answers: 1 / hits: 22489
/ 13 Years ago, fri, january 6, 2012, 12:00:00
Today (or very recently) Chrome Beta updated to 17 for me and with it i noticed some funkiness in my web app. I noticed it was because a class was being added to the body element that normally only gets put there if there is touch event support which I check like this:
try {
document.createEvent(TouchEvent);
_device.touch = true;
} catch (e) {
_device.touch = false;
}
And sure enough, i can create and trigger touch events on Chrome 17. First idea i had was, oh, i can check for touch, and see if a mouse click fails, therefore, there's a mouse, but MouseEvents trigger too.
How else can I check, without user agent sniffing, that it's an actual, touchable, device, and not just a browser that supports touch events.
More From » jquery