Results 1 to 9 of 9

Thread: Interstitial Content Box - cookie expiring date

  1. #1
    Join Date
    May 2007
    Posts
    4
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default Interstitial Content Box - cookie expiring date

    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

  2. #2
    Join Date
    Mar 2005
    Location
    SE PA USA
    Posts
    30,495
    Thanks
    82
    Thanked 3,449 Times in 3,410 Posts
    Blog Entries
    12

    Default

    Your page is in violation of Dynamic Drive's usage terms, 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 for the proper posting format when asking a question.


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

    Show Additional Thanks: International Rescue Committee - Donate or: The Ocean Conservancy - Donate or: PayPal - Donate

  3. #3
    Join Date
    May 2007
    Posts
    4
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default

    Hello,
    You are completelly right.
    I already fixed the legal conditions for using the script..
    sorry but this mistake.

    Regards, Rafa

  4. #4
    Join Date
    May 2007
    Posts
    4
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default

    1) Script Title: Interstitial Content Box (v1.1)

    2) Script URL (on DD): http://www.dynamicdrive.com/dynamici...terstitial.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

  5. #5
    Join Date
    Mar 2005
    Location
    SE PA USA
    Posts
    30,495
    Thanks
    82
    Thanked 3,449 Times in 3,410 Posts
    Blog Entries
    12

    Default

    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:

    Code:
    //2) display freqency: ["frequency_type", "frequency_value"]
    displayfrequency: ["cookie", "1"],
    and editing (near the end) this portion of its code (changes/additions red):

    Code:
    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:

    Code:
    //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.
    Last edited by jscheuer1; 05-27-2007 at 02:15 AM.
    - John
    ________________________

    Show Additional Thanks: International Rescue Committee - Donate or: The Ocean Conservancy - Donate or: PayPal - Donate

  6. #6
    Join Date
    May 2007
    Posts
    4
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default

    Thanks John ,

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

    Many thanks for your help...Rafa

  7. #7
    Join Date
    Feb 2007
    Posts
    11
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default

    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?

  8. #8
    Join Date
    Feb 2007
    Posts
    11
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default

    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!

  9. #9
    Join Date
    Feb 2007
    Posts
    11
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default

    can anyone please give me some advice?
    please....

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •