Press enter to see results or esc to cancel.

Locate Your Web user on Google Map

In this video I am showing how you can locate your Client or user of your Web Project using Google Map api and Javascript function. This will work in all platforms supporting HTML and Javascript.

<!DOCTYPE html>
<body onload="getLocation()">
<p id="demo"></p>
<iframe id="myFrame" src="" width="360" height="270" frameborder="0" style="border:0"></iframe>
var x = document.getElementById("demo");
function getLocation() {
 if (navigator.geolocation) {
 } else { 
 x.innerHTML = "Geolocation is not supported by this browser.";
function showPosition(position) {
 x.innerHTML = "Latitude: " + position.coords.latitude + 
 "<br>Longitude: " + position.coords.longitude;
 document.getElementById("myFrame").src = ''+position.coords.latitude+', '+position.coords.longitude+'&z=15&output=embed';

In the above code, Javascript will first take the location coordinates from the browser and then it will pass it to create the google map to show the location pin pointed as shown below.

You can check your location real time here,


Leave a Comment