Support by browsers might be limited. Also support by the operating system may be limited.
The following table gives an overview of the earliest browser versions that provide support for vibrations.
|Chrome||Edge||Firefox||Internet Explorer||Opera||Opera Mini||Safari|
|30||no support||16||no support||17||no support||no support|
Check if browser supports vibrations
if ('vibrate' in window.navigator) // browser has support for vibrations else // no support
Vibrate the device for 100ms:
An array of values describes periods of time in which the device is vibrating and not vibrating.
window.navigator.vibrate([200, 100, 200]);