Results 1 to 1 of 1

Thread: Drop-in content box v2.0 Cookie Bug

  1. #1
    Join Date
    Mar 2005
    Thanked 3,267 Times in 3,228 Posts
    Blog Entries

    Default Drop-in content box v2.0 Cookie Bug

    1) Script Title: Drop-in content box v2.0

    2) Script URL (on DD):

    3) Describe problem: Session only cookie does not work in IE 8 and less. Here's an updated version of the script which corrects that:


    Only the set cookie function is changed. It's changed to assure that one of the persistent modes is in play (day, hr or min) before attempting to calculate an expiration date:

    	cookiere: /^(\d+)(day|hr|min)$/, //re to parse duration if not 'session' -jds
    		var re=new RegExp(Name+"=[^;]+", "i"); //construct RE to search for target name/value pair
    		if (document.cookie.match(re)) //if cookie found
    			return document.cookie.match(re)[0].split("=")[1] //return its value
    		return null
    	setCookie:function(name, value, duration){
    		var expirestr='', expiredate=new Date()
    		if (typeof duration!=="undefined" && (duration=dropincontentbox.routines.cookiere.exec(duration))){ //if set persistent cookie and not session -jds
    			var offsetmin=duration[1] * (duration[2]==='hr'? 60 : duration[2]==='day'? 60*24 : 1)
    			expiredate.setMinutes(expiredate.getMinutes() + offsetmin)
    			expirestr="; expires=" + expiredate.toUTCString()
    		document.cookie = name+"="+value+"; path=/"+expirestr
    Last edited by jscheuer1; 06-08-2013 at 05:28 PM. Reason: detail
    - John

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

Similar Threads

  1. Replies: 18
    Last Post: 11-07-2010, 03:16 PM
  2. Switch Content Script cookie
    By o.ash92 in forum Dynamic Drive scripts help
    Replies: 5
    Last Post: 12-10-2006, 07:02 AM
  3. Featured Content Slider Cookie
    By NSOrg in forum Dynamic Drive scripts help
    Replies: 2
    Last Post: 11-23-2006, 12:54 PM
  4. Adding a Cookie to Amazon Drop-In Script
    By five_texans in forum Dynamic Drive scripts help
    Replies: 1
    Last Post: 04-22-2006, 10:53 PM
  5. Switch Content Script Cookie being deleted
    By matg in forum Dynamic Drive scripts help
    Replies: 0
    Last Post: 07-18-2005, 11:30 AM


Posting Permissions

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