0

I have a jquery inline popup triggered on load after checking for a cookie to see whether they have seen it before. (I got a lot of help on this from the user JFK.)

What I'm trying to do is display lightbox popup if the user is viewing the site from inside the USA (like Hulu does if you are viewing from outside the US).

How would I modify this script to do that ?

This is loaded in the after jquery script, and the fancybox script. The code is

<script type="text/javascript">function openFancybox() {
setTimeout( function() {$('#various1').trigger('click'); },1000);}$(document).ready(function() {
var visited = $.cookie('visited');
if (visited == 'yes') {
    return false;
} else {openFancybox();
}
$.cookie('visited', 'yes', { expires: 1 });
$('#various1').fancybox();});</script>
AShelly
  • 34,686
  • 15
  • 91
  • 152
user1037444
  • 313
  • 1
  • 6
  • 13

1 Answers1

0

There have been several questions regarding that topic already at stackoverflow. Check:

How can I detect visitor's country and redirect he/she to an specific website?, best way to detect country / location of visitor?, Location detecting tecniques for IP addresses

It's not just modifying the script above. Basically you will need to install another API or a third-party application to detect the visitor's country and then decide whether or not to run the fancybox script.

Community
  • 1
  • 1
JFK
  • 40,963
  • 31
  • 133
  • 306