Yes it is, using HTML5's Vibration API. To make the phone vibrate, use:
navigator.vibrate(1000);
However before executing this statement, you should check whether the browser supports the Vibration API. You can do this either this way:
if (window.navigator && window.navigator.vibrate) {
// Vibration supported
} else {
// Vibration not supported
}
Or this way:
if ('vibrate' in navigator) {
// Vibration supported
} else {
// Vibration not supported
}
You can also define a vibration pattern. This is possible by passing an array with [vibration, pause, vibration, pause...], like so:
// Vibrate for 3 seconds, pause for half a second, vibrate for 2 seconds, pause for half a second, vibrate for 1 second
navigator.vibrate([3000, 500, 2000, 500, 1000]);
To make the phone stop vibrating, you can use either:
navigator.vibrate(0);
Or:
navigator.vibrate([]);
Source: tutplus