Last active
May 2, 2023 03:18
-
-
Save enamhasan/de304eca3a3ac7b609a3a0abccdcca09 to your computer and use it in GitHub Desktop.
Country Redirect Popup for Shopify
This file contains 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> | |
$(document).ready(function () { | |
//alert (tt); | |
$.getJSON('http://api.db-ip.com/v2/free/self', function (data) { | |
if (data.countryCode === 'CA') { | |
//alert("BD"); | |
jQuery.fancybox.open(jQuery('#message')); | |
} | |
console.log(data.countryCode); | |
}); | |
}); | |
</script> | |
<div style="display:none;"> | |
<div id="message" style="padding:30px;"> | |
<h1>Hello!</h1> | |
<p>It seems you are from Canada, we have a Canadian website. Do you like to visit?</p> | |
<div class="eight columns" style="float: none; display: inherit; text-align: center;"> | |
<a href="http://linenway.ca" class="action_button pbtn" style="display: inline;">Visit Now</a> | |
<a href="#" onclick="closeFB()" class="action_button pbtn" style="display: inline;">No Thanks</a> | |
</div> | |
</div> | |
</div> | |
<script> | |
function closeFB() { | |
$.fancybox.close(); | |
} | |
</script> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment