PDA

View Full Version : Interstitial Content Box - cookie expiring date



rafaelb
05-23-2007, 06:48 AM
1) Script Title: Interstitial Content Box (v1.1)

2) Script URL (on DD): http://www.hera-biancardi.com

3) Describe problem: Hello,
I'm using the Interstitial Content Box (v1.1) without any problem, but I want to change the cookie session to expire in an specific DATE. ie. Thu, 31-Dec-2020 00:00:00 GMT.

What code do I need to change in the "interstitial.js" file ?

Thanks and regards, Rafa

jscheuer1
05-23-2007, 08:04 AM
Your page is in violation of Dynamic Drive's usage terms (http://www.dynamicdrive.com/notice.htm), which, among other things, state that the script credit must appear in the source code of the page(s) using the script. Please reinstate the notice first.

Warning: Please include a link to the DD script in question in your post. See this thread (http://www.dynamicdrive.com/forums/showthread.php?t=6) for the proper posting format when asking a question.

Please include a link to the demo page of the script here on Dynamic Drive.

rafaelb
05-26-2007, 08:29 AM
Hello,
You are completelly right.
I already fixed the legal conditions for using the script..
sorry but this mistake.

Regards, Rafa

rafaelb
05-26-2007, 08:33 AM
1) Script Title: Interstitial Content Box (v1.1)

2) Script URL (on DD): http://www.dynamicdrive.com/dynamicindex17/interstitial.htm

3) Describe problem: Hello,
I'm using the Interstitial Content Box (v1.1) without any problem, but I want to change the cookie session to expire in an specific DATE. ie. Thu, 31-Dec-2020 00:00:00 GMT.

What code do I need to change in the "interstitial.js" file ?


Thanks and regards, Rafa

jscheuer1
05-26-2007, 03:43 PM
Wow, Thu, 31-Dec-2020 is a long way off, 13 years + a few months, etc. In theory, you could do that though by setting this variable in the interstitial.js file (near the beginning) like so:


//2) display freqency: ["frequency_type", "frequency_value"]
displayfrequency: ["cookie", "1"],

and editing (near the end) this portion of its code (changes/additions red):


function setCookie(name, value, days){
var expireDate = new Date(2020, 11, 30) //new Date(year, month, date-1)
//set "expstring" to either an explicit date (past or future)
if (typeof days!="undefined"){ //if set persistent cookie
var expstring=expireDate.setDate(expireDate.getDate()+parseInt(days))
document.cookie = name+"="+value+"; expires="+expireDate.toGMTString()+"; "+interstitialBox.cookiesetting[1]
}
else //else if this is a session only cookie setting
document.cookie = name+"="+value+"; "+interstitialBox.cookiesetting[1]
}

But, this may interact oddly with some of the other code causing the script to think that you are always changing the expiration period and thus displaying the box every day or even every time. If that happens, it would be easier to just set a long period of expiration in the first part:


//2) display freqency: ["frequency_type", "frequency_value"]
displayfrequency: ["cookie", (365*13).toString(10)],

and leave the rest of the code alone. Then, when you get to Thu, 31-Dec-2020 edit the file again, if desired.

rafaelb
05-27-2007, 02:49 PM
Thanks John ,

I'll take the second option.. I tested and works perfect..

Many thanks for your help...Rafa

liyenn
11-23-2007, 03:35 PM
Hi, I'm also trying to customize to cookie time of this script.

May I know how can i configure it where the box appear every 1hour?

liyenn
11-23-2007, 04:54 PM
May I know how can I convert a time value to a date value?

I was thinking to use the below way to make it work but not sure whether it is working..

var minutes = 1000*60
var d = new Date()
var t = d.getTime()+minutes

Then I'll convert the var t back to Date() format and place the value here:

//2) display freqency: ["frequency_type", "frequency_value"]
displayfrequency: ["cookie", the_value_here],

Can any one let me know whether this will work? I'm a newbie in javascript and hope you can guide me~

Thank you!

liyenn
11-25-2007, 03:31 PM
can anyone please give me some advice?
please....