Skip to content

Instantly share code, notes, and snippets.

@rayboyd
Created January 30, 2011 00:22
Show Gist options
  • Save rayboyd/802364 to your computer and use it in GitHub Desktop.
Save rayboyd/802364 to your computer and use it in GitHub Desktop.
Rudimentary HTML5 feature support testing.
for (var k in html5)
console.log(k, '...', html5[k]);
(function(window, document, navigator, undefined) {
var html5 = {
appcache: !!(window.applicationCache),
audio: !!(document.createElement('audio').canPlayType),
dragdrop: !!('draggable' in document.createElement('span')),
fileapi: !!(typeof FileReader !== 'undefined'),
geolocate: !!(navigator.geolocation),
localstore: !!(('localStorage' in window) && (window['localStorage'] !== null)),
workers: !!(window.Worker),
};
// expose
window.html5 = html5;
})(this, document, navigator);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment