I'm working on a beer site and trying to get it to go to an age verification page when the site loads using jQuery Cookie.
The age page has a simple Yes to accept the cookie and No to take you away from the site and my code is:
if(!$.cookie('legal-age')){
window.location = '/age-verify/';
}
// Button
$("a#v-yes").click(function() {
$.cookie('legal-age','yes', {expires: 7, path: '/'});
window.location = '/';
return false;
});
The problem I'm having is when the site loads it goes to the requested page but keeps refreshing over and over.
Any idea how to make it go to that page and just stay without refreshing?
Thanks,
TJ.