You are currently viewing How to Use the HTML5 Vibration API

How to Use the HTML5 Vibration API

indexUsers are increasingly using smartphones and tablets to access the web. As of December 2013, one in every five web visits is from a mobile device. If your website or app is mobile-aware, that figure could be far higher.
Development for multiple devices has its challenges, but there are also possibilities which aren’t typically available on desktop PCs. Consider the vibration mechanism; it’s a simple tactile feedback device which can alert you of new messages or phone calls. It’s especially useful in a noisy environment where sound cannot be heard or quiet places where it would be a distraction.
Wouldn’t it be great if you could use vibration in your application?…

  • Walking directions could be indicated using one vibration for left, two for right.
  • The phone could vibrate in a certain way when an event occurs or you’re close to someone.
  • You could send secret messages in vibration-based morse code!
  • A game could be enhanced by vibrating when you crash or are hit by a missile.

That’s exactly what the HTML5 Vibration API allows you to do!  red more