If you set the cookie via CF then reference it anywhere via COOKIE.MyCookieName

Bryan Stevenson B.Comm.
VP & Director of E-Commerce Development
Electric Edge Systems Group Inc.
t. 250.920.8830
e. [EMAIL PROTECTED]

---------------------------------------------------------
Macromedia Associate Partner
www.macromedia.com
---------------------------------------------------------
Vancouver Island ColdFusion Users Group
Founder & Director
www.cfug-vancouverisland.com
  ----- Original Message -----
  From: David Adams
  To: CF-Talk
  Sent: Wednesday, February 11, 2004 12:48 PM
  Subject: Any advice on passing client side cookies to CF?

  Can anyone recommend simple ways of passing client side cookie values to CF?

  Below is my way, which I think is clunky.  Essentially I grab the cookie value and pass it on via the URL parameter to another page.

  <script language="_javascript_">
  function ReadCookie(name) {
     if(document.cookie == '') { // there's no cookie, so go no further
  return false;
     } else { // there is a cookie
  var firstChar, lastChar;
  var theBigCookie = document.cookie;
  firstChar = theBigCookie.indexOf(name); // find the start of 'name'
  var NN2Hack = firstChar + name.length;
  if((firstChar != -1) && (theBigCookie.charAt(NN2Hack) == '=')) { // if you found the cookie
      firstChar += name.length + 1; // skip 'name' and '='
      lastChar = theBigCookie.indexOf(';', firstChar); // Find the end of the value string (i.e. the next ';').
      if(lastChar == -1) lastChar = theBigCookie.length;
      return unescape(theBigCookie.substring(firstChar, lastChar));
  } else { // If there was no cookie of that name, return false.
      return false;
  }
     }
  }
  </script>

  <!--- The name of the cookie must be place into the single quotes--->
  <script language="_javascript_">
  var userID = ReadCookie('userIDcookie');
  location.href="">   </script>
[Todays Threads] [This Message] [Subscription] [Fast Unsubscribe] [User Settings]

Reply via email to