Best way to block certain countries from access to website
<p>I need to block certain on certain counties from accessing the website, and have made the following script below, but it does not block efficiently enough.</p>

<p>Unfortunately I do not have access to the .htaccess file or Apache config file through the CMS, so I need to solve it with  Javascript or similar coding.</p>

<p>Do you have any suggestion how to set it up or improve my script below?</p>

<pre><code>&lt;script&gt;
var langcodes = new Array("zh", "default");
var langredirects = new Array("/lang/{module_pagename}", "DEFAULT");
var languageinfo = navigator.language ? navigator.language : navigator.userLanguage;
var gotodefault = 1;
function redirectpage(dest) {
    if (window.location.replace)
       window.location.replace(dest);
    else
        window.location = dest;
}

for (i = 0; i &lt; langcodes.length - 1; i++) {
    if (languageinfo.substr(0, 2) == langcodes[i]) {
        redirectpage(langredirects[i]);
        gotodefault = 0;
        break;
    }
}
&lt;/script&gt;
</code></pre>