HTML5 APIs for game developers
One of the best and worst things about making games for web browsers is that the platform is a moving target. New features are constantly proposed, specced out and implemented. At the moment while many features are in a nascent state, keeping track of which features are available in which browsers is a bit of a pain.
This page is an effort to supply a list of HTML5 APIs that I think game developers want to know about and their availability in different browsers. Hopefully we'll gradually see this all go green.
Updates
- 2012-10-09 - PointerLock support lands in Chrome stable
- 2012-09-11 - Mozilla announced they have started work on Web Audio API
Contents
Rendering
Canvas
2D rendering
Browser | Support |
---|---|
Chrome | yes |
Firefox | yes |
Safari | yes |
Opera | yes |
IE | yes |
WebGL
3D rendering using API similar to OpenGL ES 2.0
Browser | Support |
---|---|
Chrome | yes |
Firefox | yes |
Safari | nearly* |
Opera | nearly* |
IE | no |
*In Safari and Opera WebGL must be enabled in a developer menu.
source | spec
Fullscreen API
Allow an element to render fullscreen
Browser | Support |
---|---|
Chrome | yes |
Firefox | yes |
Safari | yes |
Opera | planned |
IE | no |
Audio
Web Audio API
Low-latency audio playback for sound effects. Including effects pipeline for reverb, pan, spatial audio, etc.
Browser | Support |
---|---|
Chrome | yes |
Firefox | planned* |
Safari | yes |
Opera | no |
IE | no |
*Mozilla have announced they're working on it and progress is tracked on this issue
spec
Input
Orientation Events
Get events from accelerometers in the device
Browser | Support |
---|---|
Chrome | yes |
Firefox | yes |
Safari | yes* |
Opera | no |
IE | no |
*Mobile Safari only
source | spec
PointerLock API
Capture mouse input without moving the cursor. Required for FPS type camera control.
Browser | Support |
---|---|
Chrome | yes* |
Firefox | fullscreen mode only |
Safari | no |
Opera | no |
IE | no |
*PointerLock must be enabled in a chrome://flags
spec
Gamepad API
Get input from hardware gamepad/controllers
Browser | Support |
---|---|
Chrome | yes |
Firefox | planned* |
Safari | no |
Opera | no |
IE | no |
*Firefox builds with gamepad support are available, issue tracking it is here.
spec
Stream API / getUserMedia()
Get input from microphone or webcam
Browser | Support |
---|---|
Chrome | yes |
Firefox | planned* |
Safari | no |
Opera | yes |
IE | no |
*Firefox are planning to support getUserMedia()
source
Keyboard
Support for keyboard input that supports international keyboard layouts. There is no standardization effort on this, just an early stage proposal from Mozilla.
source
Networking
WebSockets
Continuous communication over HTTP
Browser | Support |
---|---|
Chrome | yes |
Firefox | yes |
Safari | yes |
Opera | yes |
IE | yes |
WebRTC / PeerConnection API
Realtime communication API for peer-to-peer type networking including audio and video chat.
Browser | Support |
---|---|
Chrome | nearly* |
Firefox | planned** |
Safari | no |
Opera | no |
IE | no |
*You can enable WebRTC in chrome://flags
**Mozilla have the feature planned
source | spec
Storage
Web Storage
Key-Value store for local data, that can persist between page loads. Like Cookies done right.
Browser | Support |
---|---|
Chrome | yes |
Firefox | yes |
Safari | yes |
Opera | yes |
IE | yes |
Offline Storage
Cache entire applications locally for use when offline.
Browser | Support |
---|---|
Chrome | yes |
Firefox | yes |
Safari | yes |
Opera | yes |
IE | yes |
Do you have any other suggestions for APIs you'd like to see tracked here. Or other features that game developers want that are missing from HTML5 specs? Please email us at support@playcanvas.com.
caniuse.com is great resource for checking which features are available in which browsers. It was used as a source for many of the tables above.