Quantcast
Viewing latest article 11
Browse Latest Browse All 20

Mark helps you detect everything in HTML5

Image may be NSFW.
Clik here to view.

Mark Pilgrim has a new appendix to his awesome HTML5 book, which collects all of the ways in which you can do feature detection for HTML5.

For example:

  • <audio>: return !!document.createElement('audio').canPlayType;
  • <device>: return 'type' in document.createElement('device');
  • <iframe sandbox>: return 'sandbox' in document.createElement('iframe');

This also highlights how it would be nice to have a way to do CSS feature detection. In theory CSS is declarative, but in practice we are using it to do things like animations now, and we need a way to nicely degrade gracefully.

Anyway, thanks for yet another great resource, Mark.

Make sure to check out Modernizr as a tool that does this checking for you... as well as some CSS tests.


Viewing latest article 11
Browse Latest Browse All 20

Trending Articles