I want to run a bit of code if, and only if, a visitor is from a certain country, is this possible and how would i go about doing this?
Share
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
It’s not possible with any certainty, but there are a couple of things that can be used as hints towards a visitor’s country of origin:
Accept-LanguageHTTP header tells you (if present) which language the user prefers to see – of course users can set this to whatever they want, and languages do not map 1:1 to countries.