Where am I?

Where am I?

If you think you are totally untraceable on the internet you are wrong. Most of the devices such as your computer, mobile, or even your e-television can hand out your current location. 

It's pretty simple to get the location data from your device. Many popular companies thus constantly know where you are! Thus, anonymity is a myth. 

Provide location access and check this out.

If that did not amaze you we can go even deeper to find the exact location, but it's beyond the scope of this article. Here, I'm only looking at the latitude and longitude data. This can be passed to the maps API or something like that to point to your location. If you don't know about these concepts you read about the same on Wiki or Google.

To implement this in this article, I just had to write a few lines of code, and boom, I got access to the location data. If that didn't work, you probably did not allow access to the location. Thus, it did not work correctly. Try again.

You can check out the code below. If you have any doubts ask me here.

<!DOCTYPE html>

<p>Click the button to get your coordinates.</p>

<button onclick="getLocation()">Try It</button>

<p id="demo"></p>

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;


Post a Comment