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)