-
return !!document.createElement('audio').canPlayType;
-
var a = document.createElement('audio'); return !!(a.canPlayType && a.canPlayType('audio/mpeg;').replace(/no/, ''));
-
var a = document.createElement('audio'); return !!(a.canPlayType && a.canPlayType('audio/ogg; codecs="vorbis"').replace(/no/, ''));
-
var a = document.createElement('audio'); return !!(a.canPlayType && a.canPlayType('audio/wav; codecs="1"').replace(/no/, ''));
-
var a = document.createElement('audio'); return !!(a.canPlayType && a.canPlayType('audio/mp4; codecs="mp4a.40.2"').replace(/no/, ''));
-
return !!document.createElement('canvas').getContext;
-
var c = document.createElement('canvas'); return c.getContext && typeof c.getContext('2d').fillText == 'function';
-
return 'type' in document.createElement('command');
-
return 'options' in document.createElement('datalist');
-
return 'open' in document.createElement('details');
-
return 'noValidate' in document.createElement('form');
-
return 'sandbox' in document.createElement('iframe');
-
return 'srcdoc' in document.createElement('iframe');
-
return 'autofocus' in document.createElement('input');
-
return 'placeholder' in document.createElement('input');
-
return 'placeholder' in document.createElement('textarea');
-
var i = document.createElement('input'); i.setAttribute('type', 'color'); return i.type !== 'text';
-
var i = document.createElement('input'); i.setAttribute('type', 'email'); return i.type !== 'text';
-
var i = document.createElement('input'); i.setAttribute('type', 'number'); return i.type !== 'text';
-
var i = document.createElement('input'); i.setAttribute('type', 'range'); return i.type !== 'text';
-
var i = document.createElement('input'); i.setAttribute('type', 'search'); return i.type !== 'text';
-
var i = document.createElement('input'); i.setAttribute('type', 'tel'); return i.type !== 'text';
-
var i = document.createElement('input'); i.setAttribute('type', 'url'); return i.type !== 'text';
-
var i = document.createElement('input'); i.setAttribute('type', 'date'); return i.type !== 'text';
-
var i = document.createElement('input'); i.setAttribute('type', 'time'); return i.type !== 'text';
-
var i = document.createElement('input'); i.setAttribute('type', 'datetime'); return i.type !== 'text';
-
var i = document.createElement('input'); i.setAttribute('type', 'datetime-local'); return i.type !== 'text';
-
var i = document.createElement('input'); i.setAttribute('type', 'month'); return i.type !== 'text';
-
var i = document.createElement('input'); i.setAttribute('type', 'week'); return i.type !== 'text';
-
return 'value' in document.createElement('meter');
-
return 'value' in document.createElement('output');
-
return 'value' in document.createElement('progress');
-
return 'datetime' in document.createElement('time');
-
return !!document.createElement('video').canPlayType;
-
return 'src' in document.createElement('track');
-
return 'poster' in document.createElement('video');
-
var v = document.createElement('video'); return !!(v.canPlayType && v.canPlayType('video/webm; codecs="vp8, vorbis"').replace(/no/, ''));
-
var v = document.createElement('video'); return !!(v.canPlayType && v.canPlayType('video/mp4; codecs="avc1.42E01E, mp4a.40.2"').replace(/no/, ''));
-
var v = document.createElement('video'); return !!(v.canPlayType && v.canPlayType('video/ogg; codecs="theora"').replace(/no/, ''));
-
return 'isContentEditable' in document.createElement('span');
Cross-document messaging
-
return !!window.postMessage;
Drag-and-drop
-
return 'draggable' in document.createElement('span');
File API
-
return typeof FileReader != 'undefined';
Geolocation
-
return !!navigator.geolocation;
History
-
return !!(window.history && window.history.pushState);
Local storage
-
try { return 'localStorage' in window && window['localStorage'] !== null; } catch(e) { return false; }
Microdata
-
return !!document.getItems;
Offline web applications
-
return !!window.applicationCache;
Server-sent events
-
return typeof EventSource !== 'undefined';
Session storage
-
try { return 'sessionStorage' in window && window['sessionStorage'] !== null; } catch(e) { return false; }
SVG
-
return !!(document.createElementNS && document.createElementNS('http://www.w3.org/2000/svg', 'svg').createSVGRect);
SVG in -
var e = document.createElement('div'); e.innerHTML = '<svg></svg>'; return !!(window.SVGSVGElement && e.firstChild instanceof window.SVGSVGElement);
Undo
-
return typeof UndoManager !== 'undefined';
IndexedDB
-
return !!window.indexedDB;
Web Sockets
-
return !!window.WebSocket;
Web SQL Database
-
return !!window.openDatabase;
Web Workers
-
return !!window.Worker;
Widgets: am I in one?
-
return typeof widget !== 'undefined';
XMLHttpRequest: cross-domain requests
-
return "withCredentials" in new XMLHttpRequest;
XMLHttpRequest: send as form data
-
return !!window.FormData;
XMLHttpRequest: upload progress events
-
return "upload" in new XMLHttpRequest;
<audio>
MP3格式的<audio>
Vorbis格式的<audio>
WAV格式的<audio>
AAC格式的<audio>
<canvas>
<canvas>
text API
<command>
<datalist>
<details>
<form>
约束验证
<iframe sandbox>
<iframe srcdoc>
<input autofocus>
<input placeholder>
<textarea placeholder>
<input type="color">
<input type="email">
<input type="number">
<input type="range">
<input type="search">
<input type="tel">
<input type="url">
<input type="date">
<input type="time">
<input type="datetime">
<input type="datetime-local">
<input type="month">
<input type="week">
<meter>
<output>
<progress>
<time>
<video>
<video>
captions
<video poster>
WebM格式的<video>
H.264格式的<video>
Theora格式的<video>
contentEditable
text/html
原文地址:http://diveintohtml5.info/everything.html