How can I find a user’s country using HTML5 geolocation?

find my account
how to find all email accounts in my name
how do i search for a google profile?
google account
google admin console
how to find gmail id of a person by his name
how to find accounts linked to phone number
where is the admin console in gmail

I'm familiar with HTML5 geolocation for returning rough coordinates of the user’s location.

However, how can I return the name of the country that their coordinates are in?

    var geocoder = new google.maps.Geocoder();
    geocoder.geocode({'latLng': <YOURLATLNGRESPONSEFROMGEO>}, function(results, status) {
            if (status == google.maps.GeocoderStatus.OK) {
                if (results[0]) {
                    var loc = getCountry(results);
                }
            }
        });

    function getCountry(results)
    {
        for (var i = 0; i < results[0].address_components.length; i++)
        {
        var shortname = results[0].address_components[i].short_name;
        var longname = results[0].address_components[i].long_name;
        var type = results[0].address_components[i].types;
        if (type.indexOf("country") != -1)
        {
            if (!isNullOrWhitespace(shortname))
            {
                return shortname;
            }
            else
            {
                return longname;
            }
        }
    }

}

function isNullOrWhitespace(text) {
    if (text == null) {
        return true;
    }
    return text.replace(/\s/gi, '').length < 1;
}

This is what I use :)

Solved: How do I find a friend on Spotify if I have their , Allowing identification of users by email address would be a breach of privacy, unless each user specifically agreed to it. Email your friend, and ask them to send​  Type your username and password into the blanks at the top-right corner of the screen, then click Log In. 3 Go to the person’s profile. You can find it by typing their name into the search box at the top of the screen or by clicking their name in your Friends list.

If you just want the country, here's a much simpler approach using ws.geonames.org rather than Google:

if (navigator.geolocation) {
    navigator.geolocation.getCurrentPosition(function(position) {
        $.getJSON('http://ws.geonames.org/countryCode', {
            lat: position.coords.latitude,
            lng: position.coords.longitude,
            type: 'JSON'
        }, function(result) {
            alert(result.countryName);
        });
    });
}​

Normally I would say that using a Google service would mean greater reliability, but with so many Google services being retired lately it's probably a good idea to look at some other solutions.


By the way, I did some experiments using all the free geocoding services I could find. It returns the country and the name of the service responsible as soon as one of them finds an acceptable result.

Feel free to play with it via JSFiddle: Deferred look up country code via multiple geolocation webapis

How to find a user on Reddit on desktop or mobile, Once you find a Reddit user's profile page, you'll be able to see their full comment history, as well as send them a direct message. Open Command Prompt. In Windows 10 and Windows 8, if you're using a keyboard and mouse, the fastest way is through the Power User Menu, accessible with the WIN+X shortcut. If you don't see Command Prompt in the Power User Menu, type cmd into the search bar in the Start menu, and click Command Prompt when you see it.

If you have problem getting geolocation to work like I had in Chrome, then I can recommend this alternative way (example with jQuery):

$.getJSON("https://freegeoip.net/json/", function(data) {
    const countryCode = data.country_code;
    const countryName = data.country_name;
    const ip = data.ip;
    const timezone = data.time_zone;
    const latitude = data.latitude;
    const longitude = data.longitude;

    alert("Country Code: " + countryCode);
    alert("Country Name: " + countryName);
    alert("IP: " + ip); 
    alert("Time Zone: " + timezone);
    alert("Latitude: " + latitude);
    alert("Longitude: " + longitude);   
});

FAQ: How do I find my Windows user name?, Any user in the Administrators group can be used to log in to the computer. Product, Products: LogMeIn Pro; RemotelyAnywhere  You can achieve even a simple task like identifying the current user in many ways. This tutorial will show you how to use some of the quickest and easiest methods. Why would you need to find the identity of the current user? In many cases the owner of the computer is the only user and, without getting too existential, they probably know themselves.

You will need a Reverse Geocoder service.

How to Find a User ID on Facebook: 7 Steps (with Pictures), This wikiHow teaches you how to find the user identification number (user ID) of another person on Facebook. Go to https://www.facebook.com  On Professional editions of Windows, you can enable logon auditing to have Windows track which user accounts log in and when. The Audit logon events setting tracks both local logins and network logins. Each logon event specifies the user account that logged on and the time the login took place. You can also see when users logged off.

pay attention you need set 'username' property for using this api,otherwise you'll get error.

setTimeout(function() {
                if (navigator.geolocation) {
                    navigator.geolocation.getCurrentPosition(function(position) {
                        $.getJSON('http://api.geonames.org/countryCode', {
                            lat : position.coords.latitude,
                            lng : position.coords.longitude,
                            type : 'JSON',
                            username : 'demo'
                        }, function(result) {
                            alert(result.countryName);
                        });
                    });
                }

            }, 1000);

How to find a Tumblr user with their email, Can i find a Tumblr user with their email?! Tumblr enables you connect with your friends' blogs in a variety of ways, including finding other Tumblr users via an  Two possible ways: Click the Start button. Your user name appears at the top of the Start menu. Go to Control Panel > User Accounts.

Finding eBay Members, Enter the member's user ID or email address. If you're not sure of the exact user ID, enter your closest guess. Your search results will include close matches. Instructions provided describe how to identify which folder stored in the registry under HKEY_USERS is associated with each user profile on the computer. Note: The Security Identifier (SID) is a unique name (an alphanumeric character string) that is assigned by a Windows Domain controller during the login process that is used to identify a user.

eBay Services: Feedback Forum: Find Member, To display a Member Profile for someone else, type their eBay User ID below. eBay User ID Items per page: 25, 50, 100, 200. Only know the email address?

How can I follow/unfollow a user?, Currently it is not possible to follow or unfollow a user on the website. If you are also using our mobile app please log in there in order to follow and unf.

Comments
  • Duplicate question ? stackoverflow.com/questions/6159074/…
  • See perhaps the answers to stackoverflow.com/questions/4497728/….
  • Geolocation is not part of HTML5: isgeolocationpartofhtml5.com
  • Well this is awkward w3schools.com/html/html5_geolocation.asp
  • This is almostt perfect, but google returns 'United Kingdom' rather than 'England' or 'Scotland' etc.. Ideally it needs to return 'England' etc as the purpose of the app I'm building is to identify between them two! :/
  • Look through the different types and see if you can grab what you want. code.google.com/apis/maps/documentation/geocoding/#Types
  • Just to be super picky here but it is safer to use '===' instead of '==' for comparing null values.
  • I really like the simplicity of this answer ... and its the more open answer ;)
  • The best answer for countries that block Google :)
  • Error : lease add a username to each call in order for geonames to be able to identify the calling application and count the credits
  • @zloctb: Yes it seems geonames has changed its webservice to now require a registered username: "The parameter 'username' needs to be passed with each request. The username for your application can be registered here. You will then receive an email with a confirmation link and after you have confirmed the email you can enable your account for the webservice on your account page"
  • ws.geonames.org now appears to be dead
  • neat solution with very few lines! also it doesn't require user interaction to find out his location.