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);

or

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:

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


Table Of Contents
17 Map
18 Set
28 Date
31 AJAX
42 JSON
102 Vibration API
104 Tilde
107 Events
  ↑ ↓ to navigate     ↵ to select     Esc to close