code, howto

HTML5: Vibration API

The API for telling a device to vibrate from within the browser is very new and not well supported. Can I Use does not have a listing for it and, as of this writing, support is limited to Android and Firefox mobile platforms. Browsers on iOS do not implement it and, although most Chrome versions regardless of platform include the method itself, the functionality itself is tied only to platforms like Android that allow it.

However, for those who wish to use the API, I suggest looking at the W3C Candidate Recommendation and the Mozilla Developers Network page (from which my own code comes) for information on some suggested user cases. I also advise curtailing constant usage in projects as some users my find it troubling or a drain on battery usage on mobile devices. Use with caution and respect for the user.