We're looking for a user researcher to understand the needs of developers and designers. Is this you or someone you know? Check out the post: https://mzl.la/2IGzdXS


« window

The Navigator.vibrate() method pulses the vibration hardware on the device, if such hardware exists. If the device doesn't support vibration, this method has no effect. If a vibration pattern is already in progress when this method is called, the previous pattern is halted and the new one begins instead.

If the method was unable to vibrate because of invalid parameters (e.g. too large value), it will return false (though Gecko device incorrectly throw for the moment), else it returns true.


Provides a pattern of vibration and pause intervals. Each value indicates a number of milliseconds to vibrate or pause, in alternation. You may provide either a single value (to vibrate once for that many milliseconds) or an array of values to alternately vibrate, pause, then vibrate again. See Vibration API for details.

Passing a value of 0, an empty array, or an array containing all zeros will cancel any currently ongoing vibration pattern.


window.navigator.vibrate(200); // vibrate for 200ms
window.navigator.vibrate([100,30,100,30,100,200,200,30,200,30,200,200,100,30,100,30,100]); // Vibrate 'SOS' in Morse.


Specification Status Comment
Vibration API Candidate Recommendation Initial specification.

Browser compatibility

Feature Chrome Firefox (Gecko) Internet Explorer Opera Safari
Basic support (Yes) webkit 11.0 (11.0) moz
16.0 (16.0) (no prefix) [1]
Not supported Not supported Not supported
Feature Android Firefox Mobile (Gecko) IE Mobile Opera Mobile Safari Mobile
Basic support (Yes) webkit 11.0 (11.0) moz
16.0 (16.0) (no prefix) [1]
Not supported Not supported Not supported

[1] When the vibration pattern is too long or any of its elements are too large, Gecko incorrectly throws an exception, instead of returning true (bug 884935).

See also

Document Tags and Contributors

Last updated by: teoli,