I'm using a web statistic service and I want to only allow certain states to my site as a testing mode for a certain period of time and block all non US countries.
I received the correct javascript below, but I can't figure out how to add the addtional states to the else statement. I tried everything. I don't know javascript. I need to add 19 more states to the else statement correctly. Can you give me the correct sequence to follow by adding 4 or five states as sampe to the else statement and letting me know how to end the statement correctly? The script below does work.
I received the correct javascript below, but I can't figure out how to add the addtional states to the else statement. I tried everything. I don't know javascript. I need to add 19 more states to the else statement correctly. Can you give me the correct sequence to follow by adding 4 or five states as sampe to the else statement and letting me know how to end the statement correctly? The script below does work.
Code:
<script language="JavaScript">
var geo = disp();
if (geo[0] != 'US'){
alert('Sorry this site is only accessible from the USA');
window.location = ('http://www.yahoo.com');
}
else {
if (geo[2] != 'CA' && geo[2] != 'TX' ){ (NEED TO ADD STATES HERE)
alert('Sorry this site is only accessible from California and Texas');
window.location = ('http://www.yahoo.com');
}
}
</script>
Comment