3 ms·
> I think it is time we stopped thinking in browser versions and instead check for availability of features. Great. How? Detecting features can be really dif
by MatthewPhillips 14y ago
> I think it is time we stopped thinking in browser versions and instead check for availability of features.
Great. How? Detecting features can be really difficult, it's why we need libraries like Modernizr. Some are outright impossible: try detecting touch support. I know you think you can but you can't without UA sniffing.
Even harder, try detecting mouse support.
I don't know what the history is behind document.implementation.hasFeature but I know that it doesn't work for anything but SVG today. Not sure if that's the way to go but we definitely need a better way that the try/catch and complicated loops we currently employ.
- tomjen3 14y agoI cannot detect mouse support, except on the assumption of no touch support. But to check for touch support, all you have to do is test for the existence of ontouchstarted on the window object.
- MatthewPhillips 14y ago> I cannot detect mouse support, except on the assumption of no touch support. Bad assumption, you can have a desktop with a touch screen monitor, or a tablet with a bluetooth mouse. > But to check for touch support, all you have to do is test for the existence of ontouchstarted on the window object. Firefox uses the same codebase for desktop and mobile, so you'll get false positives on laptops and desktops. It's silly the hoops we jump through to get to 75% certainty on a feature.