I m trying to block certain countries in my website.
This script will only load my website in the US, CA(Canada) and GB(Great Britain) and the alert will show if you’re accessing in other countries.
<script language="JavaScript">
var geo = disp();
if (geo[0] != 'US' && geo[0] != 'CA' && geo[0] != 'GB'){
alert('Sorry this site is only accessible from the USA, Canada
and Great Britain');
window.location = ('http://www.yahoo.com');
}
</script>
But I want to show the alert on a particular country.
What is the opposite of IF..?
Or How can I make the statement false..?
You don’t need an else if you just want to block one country.