I have read several answers and I still don't know how to do it. I need to redirect my visitors to an specific website depending on their country.I have some knowledge in html and basic javascript.
Could somebody paste the code they?
I have read several answers and I still don't know how to do it. I need to redirect my visitors to an specific website depending on their country.I have some knowledge in html and basic javascript.
Could somebody paste the code they?
Share Improve this question asked Sep 3, 2011 at 8:52 LeonardoLeonardo 211 silver badge1 bronze badge 7- 5 1- It's annoying when sites do that. Do like amazon, offer the possibility with little icons to switch sites. Don't force people to switch. I hate when I get sent to a site in Russian/Chinese/Dutch/Swahili because I'm in Russia/China/Netherlands/Rwanda... 2- No, I can't paste my code because you can't use Google and StackOverflow. – Kheldar Commented Sep 3, 2011 at 8:58
-
1
@Kheldar -- you're kidding, right? The OP is supposed to inconvenience entire countries because you can't be bothered to press the "English" button on the screen? Ironically, you'll have to forgive any typos in this post because the puter here in Đà Nẵng wants to change (for example) "you" to
yêu
,yểu
, oryếu
. – Michael Lorton Commented Sep 3, 2011 at 9:24 - @Malvolio : I think you are misreading me. What the OP is suggesting, done wrong, is an inconvenience to the Web at large. Done right, as in "as Amazon does it", it's OK. My point is precisely that I don't want to be pushed to another language because the server thinks it knows better than I, just as I don't want to be pushed to a mobile version of a site because I'm on mobile. I want choice, freedom. Not some jerk in Đà Nẵng or New York deciding what I will read in my place. I hope you understand better my position, and be aware I don't press the English button, I'm not American :p – Kheldar Commented Sep 3, 2011 at 9:44
- In other words: ideally, the website would suggest a customized version (localized, or mobile, etc), but never force it on me. – Kheldar Commented Sep 3, 2011 at 9:47
- possible duplicate of How do i track the visitor's country and redirect them to appropriate sites? – mmmmmm Commented Sep 3, 2011 at 10:56
1 Answer
Reset to default 5several ways to do this:
- use GPS tag in HTML
- requires permission from users - probably not widespread.
- this is the most accurate
- using IP address of the browser
- most people use this and you get IP to Country mapping
- http://www.codeproject./KB/aspnet/aspxcode_net.aspx
- not as accurate since browser can use proxy
- using locale settings (eg. en-US, en-UK etc)
- cheapest
- not real location but 90% of users will set correctly.