Advertisement
Guest User

Untitled

a guest
Oct 30th, 2018
161
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.06 KB | None | 0 0
  1. <!DOCTYPE html>
  2. <html lang="en" dir="ltr">
  3. <head>
  4. <meta charset="utf-8">
  5. <title></title>
  6. <script type="text/javascript">
  7. // COUNTRY CODES: https://en.wikipedia.org/wiki/ISO_3166-1_alpha-2
  8. var country_urls = {
  9. 'US':'http://google.us',
  10. 'AU':'http://google.au',
  11. };
  12.  
  13. var URL_ERRORS = 'https://errodomain.example';
  14. var URL_DEFAULT = 'https://defaultdomain.example';
  15.  
  16. var xmlhttp = new XMLHttpRequest();
  17.  
  18. xmlhttp.onreadystatechange = function() {
  19. if (this.readyState == 4 && this.status == 200) {
  20. var res = this.responseText.split(";");
  21.  
  22. if (res[0] === "1") {
  23. if (res[1] in country_urls) {
  24. top.location = country_urls[res[1]];
  25. } else {
  26. top.location = URL_DEFAULT;
  27. }
  28. } else {
  29. top.location = URL_ERRORS;
  30. }
  31. }
  32. };
  33. xmlhttp.open("GET", "https://ip2c.org/self", true);
  34. xmlhttp.send();
  35. </script>
  36. </head>
  37. <body>
  38. </body>
  39. </html>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement