What Web Can Do Today?

Can I rely on the Web Platform features to build my app?

An overview of the device integration HTML5 APIs

Vibration

The Vibration API allows Web applications to use the device's built-in vibration, if one is present.

API glimpse

navigator.vibrate(durationOrPattern)
Vibrate the device once for the duration given or according to durations pattern given.

Live Demo

  • function vibrateSimple() {
      navigator.vibrate(200);
    }
    
    function vibratePattern() {
      navigator.vibrate([100, 200, 200, 200, 500]);
    }
  • <button onclick="vibrateSimple()">Vibrate for 200 ms</button>
    <button onclick="vibratePattern()">Vibrate with pattern</button>

Resources

Get in touch