Get visitors language & country code with javascript (client-side) [duplicate]

Using jQuery, this line will display your user’s country code.

  $.getJSON('https://freegeoip.net/json/', function(result) {
    alert(result.country_code);
  });

Leave a Comment