View Full Version : DHTML Window pop up appears once only

07-30-2012, 03:49 PM
1) Script Title: DHTML Window

2) Script URL (on DD): http://www.dynamicdrive.com/forums/attachment.php?attachmentid=1533&d=1200855296

3) Describe problem: The version of the script that includes the 'sessiononly' variable works beautifully, where the pop up appears once per session.

Is it possible to configure the script so the pop up window only appears once ever?


07-31-2012, 09:07 AM
Not exactly, not with this script the way that it is, and not really period in that doing so depends upon cookies and the user could always delete the cookie.

You could edit the script. Using a text only editor like NotePad, where it has:

if (typeof sessiononly!="undefined") //set session only cookie?
persistobj.setCookie(windowname, "shown")

Make that:

if (typeof sessiononly!="undefined") //set session only cookie?
persistobj.setCookie(windowname, "shown", typeof sessiononly === 'number'? sessiononly : '')

Then when you're using the open command, instead of specifying true or some string for sessiononly, specify an unquoted number, such as 365, which will set the cookie for a year. Each time the user revisits the page, as long as they have cookies enabled and haven't deleted this one yet, a new 1 year cookie will be set.

The browser cache may need to be cleared and/or the page refreshed to see changes.

If you want more help, please include a link to the page on your site that contains the problematic code so we can check it out.

10-08-2012, 03:55 PM
Thanks very much for the solution, it works great. Apologies for the very late reply, I mislaid all information to this site.