URL redirection script by country

Asked

Viewed 114 times

-4

I wonder if there is a script like this for example:

<script type="text/javascript">
    / / Javascript URL redirection
    window.location.replace("Site de destino");
</script>

But that had the function of redirecting only users from country X within the blog to an external site "target site"

  • only if you request the browser location or are based on the culture used...

1 answer

1

I recommend taking a look at Geoplugin, works by API and is easy to use. Taking the country of origin, a simple redirect Javascript should solve your problem. Something like:

if(geoplugin_countryCode()) === "CN")
  window.location.replace("http://stackoverflow.com");
<script language="JavaScript" src="http://www.geoplugin.net/javascript.gp" type="text/javascript"></script>

Browser other questions tagged

You are not signed in. Login or sign up in order to post.