Reputation: 2545
I need to fetch the client ip address, country and Language from the server. I had written my code like this in controller.
setDefaultEnglish();
function setDefaultEnglish() {
var url = "//freegeoip.net/json/";
$http.get(url).then(function(response){
});
This is giving me ip address and country name. I also need language along with these two. Kindly help
Upvotes: 1
Views: 815
Reputation: 484
You can use JS function to get the browser language. reference : https://www.w3schools.com/jsref/prop_nav_language.asp
<script type="text/javascript">
var userLanguage = navigator.language || navigator.userLanguage;
console.log(userLanguage);
</script>
Upvotes: 2