So far my idea was to implement a function popup("url") checking for an existing cookie which is triggered by loading the body of the page (onLoad - not a nice solution I know). I used the exact code from here to implement cookie functionality which I included in my application.js . There I also included my popup()
function:
function popUp(startimage) {
var x = readCookie('ecocrowd')
if (x = 'nopopup') {
}
else {
jQuery.slimbox(startimage);
}
}
In the html-template for my start page I included the following parts:
<body onLoad="popup("wirdiezukunft.png")">
and
<script>createCookie('ecocrowd','nopopup',7)</script>
Am I missing something out? It is the first time I am working with a Javascript implementation like this so I would appreciate any kind of help. Thanks in advance!
update (content of createcookie() ):
function createCookie(name,value,days) {
if (days) {
var date = new Date();
date.setTime(date.getTime()+(days*24*60*60*1000));
var expires = "; expires="+date.toGMTString();
}
else var expires = "";
document.cookie = name+"="+value+expires+"; path=/";
}