Skip to content
Related Articles
Open in App
Not now

Related Articles

HTML DOM Geolocation coords.speed Property

Improve Article
Save Article
Like Article
  • Last Updated : 01 Jun, 2022
Improve Article
Save Article
Like Article

In this article, we will discuss the Geolocation speed property. Geolocation in HTML is used to get the geographical position of a user.

The coords.speed property is used to return the speed in the location in meters per second (mps).



Example: The following HTML code will return the speed.


<!DOCTYPE html>
    <meta charset="utf-8">
    <meta name="viewport"
    <h2 style="color:green">GeeksforGeeks</h2>
<p><b> Displaying Speed in MPS</b></p>
    <button onclick="getlocation()"> Click Me </button>
    <p id="paraID"></p>
      var variable1 = document.getElementById("paraID");
      function getlocation() {
      function showLoc(pos) {
          variable1.innerHTML = "Speed: "
            + pos.coords.speed;


Supported Browsers: 

  • Google Chrome 5 and above
  • Edge 12 and above
  • Internet Explorer 9.0 and above
  • Firefox 3.5 and above 
  • Opera 16.0 and above
  • Safari 5 and above
My Personal Notes arrow_drop_up
Like Article
Save Article
Related Articles

Start Your Coding Journey Now!