(Speszony? Przeczytaj Sprawdzanie poziomu obsługi elementów HTML5, aby dowiedzieć się o co chodzi. Wolisz kompletną bibliotekę? Użyj Modernizr.)
<audio>
return !!document.createElement('audio').canPlayType;
<audio>
w formacie MP3var a = document.createElement('audio'); return !!(a.canPlayType && a.canPlayType('audio/mpeg;').replace(/no/, ''));
<audio>
w formacie Vorbisvar a = document.createElement('audio'); return !!(a.canPlayType && a.canPlayType('audio/ogg; codecs="vorbis"').replace(/no/, ''));
<audio>
w formacie WAVvar a = document.createElement('audio'); return !!(a.canPlayType && a.canPlayType('audio/wav; codecs="1"').replace(/no/, ''));
<audio>
w formacie AACvar a = document.createElement('audio'); return !!(a.canPlayType && a.canPlayType('audio/mp4; codecs="mp4a.40.2"').replace(/no/, ''));
<canvas>
return !!document.createElement('canvas').getContext;
<canvas>
API tekstowevar c = document.createElement('canvas'); return c.getContext && typeof c.getContext('2d').fillText == 'function';
<command>
return 'type' in document.createElement('command');
<datalist>
return 'options' in document.createElement('datalist');
<details>
return 'open' in document.createElement('details');
<form>
egzekwowanie ograniczeńreturn 'noValidate' in document.createElement('form');
<iframe sandbox>
return 'sandbox' in document.createElement('iframe');
<iframe srcdoc>
return 'srcdoc' in document.createElement('iframe');
<input autofocus>
return 'autofocus' in document.createElement('input');
<input placeholder>
return 'placeholder' in document.createElement('input');
<textarea placeholder>
return 'placeholder' in document.createElement('textarea');
<input type="color">
var i = document.createElement('input'); i.setAttribute('type', 'color'); return i.type !== 'text';
<input type="email">
var i = document.createElement('input'); i.setAttribute('type', 'email'); return i.type !== 'text';
<input type="number">
var i = document.createElement('input'); i.setAttribute('type', 'number'); return i.type !== 'text';
<input type="range">
var i = document.createElement('input'); i.setAttribute('type', 'range'); return i.type !== 'text';
<input type="search">
var i = document.createElement('input'); i.setAttribute('type', 'search'); return i.type !== 'text';
<input type="tel">
var i = document.createElement('input'); i.setAttribute('type', 'tel'); return i.type !== 'text';
<input type="url">
var i = document.createElement('input'); i.setAttribute('type', 'url'); return i.type !== 'text';
<input type="date">
var i = document.createElement('input'); i.setAttribute('type', 'date'); return i.type !== 'text';
<input type="time">
var i = document.createElement('input'); i.setAttribute('type', 'time'); return i.type !== 'text';
<input type="datetime">
var i = document.createElement('input'); i.setAttribute('type', 'datetime'); return i.type !== 'text';
<input type="datetime-local">
var i = document.createElement('input'); i.setAttribute('type', 'datetime-local'); return i.type !== 'text';
<input type="month">
var i = document.createElement('input'); i.setAttribute('type', 'month'); return i.type !== 'text';
<input type="week">
var i = document.createElement('input'); i.setAttribute('type', 'week'); return i.type !== 'text';
<meter>
return 'value' in document.createElement('meter');
<output>
return 'value' in document.createElement('output');
<progress>
return 'value' in document.createElement('progress');
<time>
return 'datetime' in document.createElement('time');
<video>
return !!document.createElement('video').canPlayType;
return 'src' in document.createElement('track');
<video poster>
return 'poster' in document.createElement('video');
<video>
w formacie WebMvar v = document.createElement('video'); return !!(v.canPlayType && v.canPlayType('video/webm; codecs="vp8, vorbis"').replace(/no/, ''));
<video>
w formacie H.264var v = document.createElement('video'); return !!(v.canPlayType && v.canPlayType('video/mp4; codecs="avc1.42E01E, mp4a.40.2"').replace(/no/, ''));
<video>
w formacie Theoravar v = document.createElement('video'); return !!(v.canPlayType && v.canPlayType('video/ogg; codecs="theora"').replace(/no/, ''));
contentEditable
return 'isContentEditable' in document.createElement('span');
- przekazywanie danych między dokumentami
return !!window.postMessage;
- Przeciąganie
return 'draggable' in document.createElement('span');
- API File
return typeof FileReader != 'undefined';
- Geolokalizacja
return !!navigator.geolocation;
- Historia
return !!(window.history && window.history.pushState);
- Local storage
try { return 'localStorage' in window && window['localStorage'] !== null; } catch(e) { return false; }
- Mikrodane
return !!document.getItems;
- Aplikacje sieciowe offline
return !!window.applicationCache;
- Zdarzenia serwerowe
return typeof EventSource !== 'undefined';
- Sesja
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 w
text/html
var e = document.createElement('div'); e.innerHTML = '<svg></svg>'; return !!(window.SVGSVGElement && e.firstChild instanceof window.SVGSVGElement);
- Cofanie
return typeof UndoManager !== 'undefined';
- IndexedDB
return !!window.indexedDB;
- Web Sockets
return !!window.WebSocket;
- Baza danych Web SQL
return !!window.openDatabase;
- Web Workers
return !!window.Worker;
- Widżety: czy jestem w jednym z nich?
return typeof widget !== 'undefined';
- XMLHttpRequest: żądania międzydomenowe
return "withCredentials" w nowym XMLHttpRequest;
- XMLHttpRequest: wysyłanie jako dane formularza
return !!window.FormData;
- XMLHttpRequest: zdarzenia postępu wysyłania
return "upload" w nowym XMLHttpRequest;
Dodatkowa lektura
Specyfikacje i standardy:
- HTML5
- Geolocation
- Server-Sent Events
- IndexedDB
- UndoManager
- Web Sockets
- Web SQL Database
- Web Storage
- Web Workers
- Widgets
- XMLHttpRequest
Biblioteki JavaScript:
- Modernizr, biblioteka do wykrywania obsługi HTML5