What is the Vibration API in HTML5 ? Last Updated : 05 Jun, 2023 Comments Improve Suggest changes Like Article Like Report Vibration is a sensation that triggers curiosity in a user and tends to make them perform a task. For example, in Fitness trackers, the vibration alert reminds user if they have been sitting too long and would potentially make them take a walk or move away from the desk or vibrations in phones or smartwatches triggers a user to look at the message alerts or attend calls. The Vibration API does this by accessing the hardware of the software only if it exists. It is supported by HTML5 for the same and in browsers, supported by only Firefox, Chrome, and Microsoft Edge on PC, and faint support by Chrome, Android, Opera, and Samsung Internet on mobile devices. Practically speaking, this feature is supported on mobile devices only. Example: In this example, we will use Vibration API. HTML <!DOCTYPE html> <html> <head> <!-- Include the Bootstrap CDN --> <link href= "https://cdn.jsdelivr.net/npm/[email protected]/dist/css/bootstrap.min.css" rel="stylesheet" /> </head> <body style="text-align: center"> <h1 style="color: green">I love GFG</h1> <!-- Add button for a single vibration --> <button type="button" class="btn btn-primary" onclick="vibrate1(1000)"> Once </button> <!-- Add button for vibration pattern --> <button type="button" class="btn btn-secondary" onclick="vibrate2()"> Pattern followed </button> <script> function vibrate1(milli) { // Vibrates once for the number of // milliseconds passed as the argument navigator.vibrate(milli); } function vibrate2() { // Vibrates in a pattern by // according to the given array navigator.vibrate( [400, 150, 300, 120, 200] ); } </script> </body> </html> Output: To access your local site on your mobile, find your IP address and open in the following link in your mobile browser: http://<your ip address>:<port>/index.html You can find out your actual IP address by using ipconfig command on Windows and ifconfig command on Linux. Now, on opening it on your mobile browser, you can access the buttons and experience the Vibration API's feature. Comment More infoAdvertise with us Next Article What is the Vibration API in HTML5 ? dikshapatro Follow Improve Article Tags : Web Technologies HTML Web technologies HTML5 Web-API HTML-Questions +2 More Similar Reads What is Velocity Draw in HTML5 ? Velocity.js is a JavaScript animation library that we used to create some great animations with HTML5. It provides a set of features for manipulating and animating elements in a web page or our display browser. The Velocity Draw or Velocity.js feature is not a specific part of the library, but a gen 4 min read Web Vibration API | Navigator.vibrate() Method The Navigator.vibrate() method uses the vibration hardware on the device, if there is any such hardware which exists. If the device doesn't support vibration then this method will not be affected. If a vibration pattern has already started when this method was called, the previous pattern will be st 2 min read Web API Vibration Web API Vibration enables web developers to manage device vibrations and enrich user interactions. The Web API Vibration is a part of the Web APIs that enable web developers to interact with the hardware features of a user's device. Specifically, it allows developers to control the vibration motor o 4 min read What are the main functions of HTML DOM ? DOM or Document Object Model is an API(Application Programming Interface) that represents the HTML document in the form of the Tree structure such that programs can access and change the style and structure of the HTML document. The DOM object is automatically created by the web browser itself upon 3 min read HTML5 | Introduction HTML5 is the fifth version of Hypertext Markup Language (HTML), a standard language used to structure webpages. It defines how content on a webpage should be structured and displayed. Here are some key points of HTML5Multimedia Support: Embeds audio and video without plugins.New Form Controls: Inclu 11 min read Interesting Facts About HTML5 APIs HTML5 APIs, though often operating behind the scenes, are fundamental to enhancing web functionality and user experience. These APIs serve as powerful tools, enabling developers to create dynamic, interactive, and feature-rich web applications.1. Geo API is used to catch the locationIt helps to get 2 min read What are the media element tags introduced by HTML5 ? HTML5 introduced 5 most popular media element tags i.e. <audio>, <video>, <source>, <embed>, <track>. These media element tags changed the entire development using HTML. In this article, you will get to know about these five media element tags briefly.Media Tags:Media T 3 min read HTML ondurationchange Attribute The HTML ondurationchange Attribute is an event attribute that occurs when the audio/video duration is changed. The duration of the audio/video is changed from âNaNâ to the actual duration of the audio/video when it loads. Syntax: <element ondurationchange="myScript"> Attribute Value: This att 1 min read Web API Media Session Web API Media Session is a powerful JavaScript feature that allows web developers to take control of media playback within their applications. By using it you can customize media notifications. It provides different actions by which you can control media playback and provide its metadata. Web API In 3 min read Which specific tag is used to blink the text in HTML ? The HTML <blink> tag is used to create a blinking text that flashes slowly. It has been obsolete all told fashionable browsers whereas some browsers never supported it in the least. This tag was also never standardized by hypertext mark-up language. You may recreate an identical visual impact 2 min read Like