JavaScript suggest change

Vibration API

Modern mobile devices can vibrate. The Vibration API allows Web apps the trigger vibration of the device (if its supported by the hardware).

Support by browsers and operating systems might be limited.

Single vibration

Vibrate the device for 100 ms:

const didVibrate = window.navigator.vibrate(100);


const didVibrate = window.navigator.vibrate([100]);

Check if vibration is supported

Check if browser supports vibrations

if ('vibrate' in window.navigator) {
    // browser has support for vibrations
} else {
    // no support

Vibration patterns

An array of values describes periods of time in which the device is vibrating and not vibrating.

window.navigator.vibrate([200, 100, 200]);

Feedback about page:

Optional: your email if you want me to get back to you:

Table Of Contents