QNimate

  • CoursesVideos
  • WP PremiumPlugins
  • DemosLab
  • Bitcoin BankingBuy, Sell, Store and Earn Interest
  • Home
  • QIdea
  • QTrack
Home Carbon Ads JavaScript Vibration API with Demo

JavaScript Vibration API with Demo

This post is a part 3 of Advanced JavaScript APIs post series.

Vibration API is mostly available in phones. Its used to vibrate your phone.

window.navigator property exposes a function called as vibrate(). This function take milliseconds as argument and vibrates the phone for that long.

if("vibrate" in window.navigator)
{
   navigator.vibrate(2000);
}
else
{
   console.log("Your browser doesn't support vibration API");
}

Jan 28, 2015Narayan Prusty
Github Style Markdown Editor and PreviewHTML5 Battery Status API with Code Example
Comments: 2
  1. Website design in Oakville
    3 years ago

    Wonderful resourceful information. I actually like what I’ve
    acquired here. You make your site articles easy and
    enjoyable to grasp. a
    I can not wait to learn more from you. Bookmarked!

    ReplyCancel
  2. Eric
    5 years ago

    Hi there,

    I have tested this and it worked on Firefox.

    But it won’t work on Chrome 42 and default android browser. I am using Samsung Note 2.

    Can it work on Chrome for you?

    Thanks.

    ReplyCancel

Leave a Reply Cancel reply

To create code blocks or other preformatted text, indent by four spaces:

    This will be displayed in a monospaced font. The first four
    spaces will be stripped off, but all other whitespace
    will be preserved.
    
    Markdown is turned off in code blocks:
     [This is not a link](http://example.com)

To create not a block, but an inline code span, use backticks:

Here is some inline `code`.

Narayan Prusty

I am a full-stack web developer. I specialize in Blockchain and JavaScript. This is my personal blog where I write about programming and technologies that I learn and feel interesting to share.

6 years ago 3 Comments Web Development
Share this
0
GooglePlus
0
Facebook
0
Twitter
0
Linkedin
Related Articles
  • Vibrating Phone using Intel XDK
  • Check if CSS property is supported using CSS and JavaScript
  • Passing Objects To addEventListener
  • Changing Text Selection Color Using CSS
  • Generate Unique Number in JavaScript
Our Sponsor
Freelance: I am available
@narayanprusty
Hi, I am a full-stack developer - focusing on JavaScript, WordPress, Blockchain, DevOps, Serverless and Cordova. You can outsource your app development to me.





Will get back to you soon!!!
WordPress
ReactJS
Meteor
Blockchain
Serverless
Kubernetes
DevOps
DB & Storage
Ejabberd
Let's get started
My Books

2014 - 2015 © QNimate
All tutorials MIT license