Created
November 30, 2016 16:45
-
-
Save dylanjhunt/133b9005c1406d199fc17b8911f8a879 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<script> | |
jQuery.ajax( { | |
url: '//freegeoip.net/json/', | |
type: 'POST', | |
dataType: 'jsonp', | |
success: function(location) { | |
// If the visitor is browsing from Canada. | |
if (location.country_code === 'CA') { | |
// Redirect him to the Canadian store. | |
window.top.location.href = 'http://dylanjh.com'; | |
} | |
} | |
} ); | |
</script> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment