Skip to content

Instantly share code, notes, and snippets.

@thetrickster
Created July 8, 2013 01:21
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save thetrickster/5945621 to your computer and use it in GitHub Desktop.
Save thetrickster/5945621 to your computer and use it in GitHub Desktop.
Disable visitors of a certain country or countries access to your site by redirecting them to another page in Business Catalyst
var userCountryCode = "{module_visitorcountrycode}";
var disallowedCountryCodes = ["US", "UK"];
var redirectBlockedUsersURL = "/country-blocked.html";
(function($) {
$.each(disallowedCountryCodes, function(i,val) {
if ( val == userCountryCode ) {
window.location = redirectBlockedUsersURL;
}
});
})(jQuery);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment