What I am trying to do is redirect countries, based on country code with the script below. The code below does not work. Doing some research I found I have to use an or statement or at least that's what I think I need, but my question is there an easier way then an or statement? As you can see there are a lot countries I am checking for.
<script language="JavaScript" src="http://j.maxmind.com/app/geoip.js"></script>
<script language="JavaScript">
var country= geoip_country_code();
if(country = "UK","CA","DE","DK","FR","AU","SE","CH","NL","IT","BE","AT","ES","NO","IE","FI","GB","US")
{
window.location.href='http://www.google.com';
}
else
{
window.location.href='http://www.yahoo.com';
}
</script>
An alternative is elaborated by elaborating its statements. If one statement fails, then the alternative fails. If all statements succeed, then the alternative succeeds.
Alternative is defined as something that does not conform to existing or mainstream standards. Acupuncture is an example of an alternative medical treatment. The definition of alternative is something that is a possible selection. The route you decided to take is an example of an alternative route.
Alternative sentences are sometimes offered and include different combinations of the following: a suspended sentence, probation, fines, restitution, community service and deferred adjudication/pretrial diversion.
Some common synonyms of alternative are choice, election, option, preference, and selection. While all these words mean "the act or opportunity of choosing or the thing chosen," alternative implies a need to choose one and reject another possibility.
You should be able to do it like this:
var countryCodes = ["UK","CA","DE","DK","FR","AU","SE","CH","NL","IT","BE","AT","ES","NO","IE","FI","GB","US"];
var country= geoip_country_code();
if (countryCodes.indexOf(country) !== -1)
{
...
}
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With