Skip to main content

HTML5 APIs for game developers

· 5 min read

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

BrowserSupport
Chromeyes
Firefoxyes
Safariyes
Operayes
IEyes

source

WebGL

3D rendering using API similar to OpenGL ES 2.0

BrowserSupport
Chromeyes
Firefoxyes
Safarinearly*
Operanearly*
IEno

*In Safari and Opera WebGL must be enabled in a developer menu.
source | spec

Fullscreen API

Allow an element to render fullscreen

BrowserSupport
Chromeyes
Firefoxyes
Safariyes
Operaplanned
IEno

source | spec


Audio

Web Audio API

Low-latency audio playback for sound effects. Including effects pipeline for reverb, pan, spatial audio, etc.

BrowserSupport
Chromeyes
Firefoxplanned*
Safariyes
Operano
IEno

*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

BrowserSupport
Chromeyes
Firefoxyes
Safariyes*
Operano
IEno

*Mobile Safari only
source | spec

PointerLock API

Capture mouse input without moving the cursor. Required for FPS type camera control.

BrowserSupport
Chromeyes*
Firefoxfullscreen mode only
Safarino
Operano
IEno

*PointerLock must be enabled in a chrome://flags
spec

Gamepad API

Get input from hardware gamepad/controllers

BrowserSupport
Chromeyes
Firefoxplanned*
Safarino
Operano
IEno

*Firefox builds with gamepad support are available, issue tracking it is here.
spec

Stream API / getUserMedia()

Get input from microphone or webcam

BrowserSupport
Chromeyes
Firefoxplanned*
Safarino
Operayes
IEno

*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

BrowserSupport
Chromeyes
Firefoxyes
Safariyes
Operayes
IEyes

source | spec

WebRTC / PeerConnection API

Realtime communication API for peer-to-peer type networking including audio and video chat.

BrowserSupport
Chromenearly*
Firefoxplanned**
Safarino
Operano
IEno

*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.

BrowserSupport
Chromeyes
Firefoxyes
Safariyes
Operayes
IEyes

source | spec

Offline Storage

Cache entire applications locally for use when offline.

BrowserSupport
Chromeyes
Firefoxyes
Safariyes
Operayes
IEyes

source | spec

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.

note

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.