I want to show some links only if the user from india,in my blogger blog. But only with js, without php or any other language.
Asked
Active
Viewed 168 times
1
-
Possible duplicate of [how to get the browser language using javascript](http://stackoverflow.com/questions/8199760/how-to-get-the-browser-language-using-javascript) – kind user Mar 08 '17 at 14:51
-
Could be a duplicate of [How to get visitor's location (i.e. country) using javascript geolocation](http://stackoverflow.com/questions/3489460/how-to-get-visitors-location-i-e-country-using-javascript-geolocation). – Chad Mar 08 '17 at 14:53
1 Answers
-1
You could read Navigator for localization and change the attribute of the html element.
Using language | NavigatorLanguage.language
Using location | Navigator.geolocation (can't post 2 links)
"developer.mozilla.org/en-US/docs/Web/API/Navigator/geolocation"
const changeLink = document.querySelector(".theLinkThatChanges");
if (window.navigator.language == 'EN') {
changeLink.setAttribute("src", "https://www.englishlink.here");
}
Note: I added my own answer after clicking through 4 of those "duplicates" without clear and sourced top answers.

hello
- 9
- 4