//Vibrate for 1 second
navigator.vibrate(1000);
//Vibrate for 2 second
navigator.vibrate(2000);
//Stop vibrating
navigator.vibrate(0);
//or
navigator.vibrate([]);
// Vibrate for one second, wait for half a second, then vibrate for two second
navigator.vibrate([1000, 500, 2000]);
//The pattern can be as long as you desire
navigator.vibrate([500, 200, 1000, 500, 1000]);
See the Pen Triggering vibrations from your website by Karna Malone (@kknmalone) on CodePen.