Obviously, this isn't going to work on a touch device like the iPad or smartphones.
How can I detect whether the browser supports hover events like onmouseover or onmouseout and the :hover pseudotag in CSS?
Note: I know that if I'm concerned about this I should write it a different way, but I'm curious as to whether detection can be done.
Edit: When I say, "supports hover events", I really mean, "does the browser have a meaningful representation of hover events". If the hardware supports it but the software doesn't (or vice versa), there's no meaningful representation. With the exception of some upcoming tech, I don't think any touch devices have a meaningful representation of a hover event.
var supportsTouch = (typeof Touch == "object");
Just detect if it's a touch device and then do your special stuff. This is the simplest approach since most touch devices emulate mouse events but no mouse driven device emulates touch events.