I'm using this script and I want to save cookie when someone clicks inside iframe box, how can I do that, with this one, script repeats loading every time when user loads page, I would like to "hide" this for one day, and show i
<script>
<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.11.2/jquery.min.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/jquery-cookie/1.4.1/jquery.cookie.js"></script>
<script type="text/javascript">
var sec = 60;
var timer = setInterval(function () {
$("#wait").html('Ili sacekaj '+ eval(sec=sec -1) +' sekundi');
}, 1000);
setTimeout(function () {
gasi();
clearInterval(timer);
}, 86400000000);
window.onscroll = function () {
if($.cookie('iframe')===undefined){
// window.scrollTo(500,500);
}
};
$(window).on('blur',function(e) {
if($(this).data('mouseIn') != 'yes')return;
$('iframe').filter(function(){
return $(this).data('mouseIn') == 'yes';
}).trigger('iframeclick');
});
$(window).mouseenter(function(){
$(this).data('mouseIn', 'yes');
}).mouseleave(function(){
$(this).data('mouseIn', 'yes');
});
$('iframe').mouseenter(function(){
$(this).data('mouseIn', 'yes');
$(window).data('mouseIn', 'yes');
}).mouseleave(function(){
$(this).data('mouseIn', null);
});
$('iframe').on('iframeclick', function(){
console.log('Clicked inside iframe');
$.cookie('iframe', '1', { expires: 1, path: '/' });
location.reload();
});
$(window).on('click', function(){
console.log('Clicked inside window');
}).blur(function(){
console.log('window blur');
});
function gasi()
{
$.cookie('iframe', '1', { expires: 1, path: '/' });
location.reload();
}
</script>