Last active
April 20, 2018 10:53
-
-
Save dylanjhunt/b73fc2747a734fd3fe56bb033456455d 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') { | |
// Tell him about the Canadian store. | |
jQuery.fancybox.open(jQuery('#message')); | |
} | |
} | |
} ); | |
</script> | |
<div style="display:none;"> | |
<div id="message" style="padding:30px;"> | |
<h1>Hello!</h1> | |
<p>You are in Canada, and we have a Canadian website <a href="https://dylanjh.com">here</a>.</p> | |
</div> | |
</div> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment