A complete guide on using the HTML5 Vibration API.
The Vibration API is an API specifically made for mobile devices as they are thankfully the only devices that have a vibrate function. The API allows developers to vibrate a device (in a pattern) for a given duration.
The vibration API is implemented in navigator.vibrate. So calling the function makes your phone vibrate.