HTML DOM Geolocation position Property Last Updated : 14 Jun, 2023 Comments Improve Suggest changes Like Article Like Report The Geolocation position property in HTML DOM is used to return the position of a device on Earth. The returned Coordinates object could be used for various purposes including navigation and tracking the position of the device. Return Value: position.coords: The coordinates object that has all the information of the current location.position.timestamp: It represents the DOMTimeStamp which represents the time when the location is obtained. Usage: Methods like getCurrentPosition() or watchPosition() are used to pass a callback to a function and then access the position property. Example: html <!DOCTYPE html> <html> <title> DOM Geolocation position Property </title> <body> <h1 style = "color: green"> GeeksforGeeks </h1> <b> DOM Geolocation position Property </b> <p> Click the button to get your position. </p> <button onclick = "getLocation()"> Get Location </button> <p class = "location"></p> <script> let x = document.querySelector('.location'); function getLocation() { /* Check if location support is available */ if (navigator.geolocation) { /* Callback to the showPosition function */ navigator.geolocation.getCurrentPosition(showPosition); } else { x.innerHTML = "Geolocation is not supported."; } } function showPosition(position) { x.innerHTML = "Latitude: " + /* Get the latitude from the Coordinates object */ position.coords.latitude + "<br>Longitude: " + /* Get the longitude from the Coordinates object */ position.coords.longitude + "<br>Timestamp: " + /* Get the timestamp of the location obtained */ position.timestamp; } </script> </body> </html> Output: Before Click on the button: After Click on the button: Supported Browsers: The browser supported by DOM Geolocation position property are listed below: Google Chrome 79.0 and aboveEdge 79.0 and aboveInternet Explorer 9.0Firefox 72.0 and above Opera 16.0 and aboveSafari 13.1 and above Create Quiz Comment S sayantanm19 Follow 0 Improve S sayantanm19 Follow 0 Improve Article Tags : Web Technologies HTML HTML-DOM Explore HTML BasicsHTML Introduction4 min readHTML Editors4 min readHTML Basics7 min readStructure & ElementsHTML Elements4 min readHTML Attributes7 min readHTML Headings3 min readHTML Paragraphs3 min readHTML Text Formatting4 min readHTML Block and Inline Elements3 min readHTML Charsets4 min readListsHTML Lists3 min readHTML Ordered Lists5 min readHTML Unordered Lists4 min readHTML Description Lists3 min readVisuals & MediaHTML Colors11 min readHTML Links Hyperlinks2 min readHTML Images7 min readHTML Favicon4 min readHTML Video4 min readLayouts & DesignsHTML Tables10 min readHTML Iframes4 min readHTML Layout4 min readHTML File Paths3 min readProjects & Advanced TopicsHTML Forms5 min readHTML5 Semantics5 min readHTML URL Encoding4 min readHTML Responsive Web Design11 min readTop 10 Projects For Beginners To Practice HTML and CSS Skills8 min readTutorial ReferencesHTML Tags - A to Z List15+ min readHTML Attributes Complete Reference8 min readHTML Global Attributes5 min readHTML5 Complete Reference8 min readHTML5 MathML Complete Reference3 min readHTML DOM Complete Reference15+ min readHTML DOM Audio/Video Complete Reference2 min readSVG Element Complete Reference5 min readSVG Attribute Complete Reference8 min readSVG Property Complete Reference7 min readHTML Canvas Complete Reference4 min read Like