DEV Community

Calvin
Calvin

Posted on

Reading Snippets [57 => Navigator.vibrate] ๐Ÿ“ฑ

I came across an interesting tweet by Eddy Vinick, also known as @veinq_ on Twitter. Thanks to his tweet, I learned that Twitter uses Navigator.vibrate(x) on its website to make your phone vibrate when you like a tweet:

window.navigator.vibrate(200);

I decided to do some more research into this cool piece of code and I found out some more interesting tidbits:

๐Ÿ•บ Within the parentheses of the method, a pattern (value) is provided to determine the number of seconds to vibrate or pause.

๐Ÿ•บ The vibration API is specifically made for mobile devices

๐Ÿ•บ The navigator.vibrate is not compatible with Internet Explorer, Opera, and Safari on desktop.

๐Ÿ•บ The navigator.vibrate method is not compatible with Safari on IOS.

SRC: Mozilla Documentation

Top comments (0)