Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <!DOCTYPE html>
- <html lang="en" dir="ltr">
- <head>
- <meta charset="utf-8">
- <title></title>
- <script type="text/javascript">
- // COUNTRY CODES: https://en.wikipedia.org/wiki/ISO_3166-1_alpha-2
- var country_urls = {
- 'US':'http://google.us',
- 'AU':'http://google.au',
- };
- var URL_ERRORS = 'https://errodomain.example';
- var URL_DEFAULT = 'https://defaultdomain.example';
- var xmlhttp = new XMLHttpRequest();
- xmlhttp.onreadystatechange = function() {
- if (this.readyState == 4 && this.status == 200) {
- var res = this.responseText.split(";");
- if (res[0] === "1") {
- if (res[1] in country_urls) {
- top.location = country_urls[res[1]];
- } else {
- top.location = URL_DEFAULT;
- }
- } else {
- top.location = URL_ERRORS;
- }
- }
- };
- xmlhttp.open("GET", "https://ip2c.org/self", true);
- xmlhttp.send();
- </script>
- </head>
- <body>
- </body>
- </html>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement