Send Geo-location from Browser

Create a button and log the current LAT/LON when the button is pressed:

<button id="send-location"> Send location</button>
document.querySelector('#send-location').addEventListener('click', () => {

    if (!navigator.geolocation) {

        return alert ('Geolocation not supported by Browser !')

    }
    
    navigator.geolocation.getCurrentPosition((position) => {

        console.log(position)

    })

console.log output

HTML Skeleton file and VS Code

Just type ! and press the TAB key 🙂

! <TAB> creates :

<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <meta http-equiv="X-UA-Compatible" content="ie=edge">
    <title>Document</title>
</head>
<body>
    
</body>
</html>