SitePoint Sponsor

User Tag List

Results 1 to 4 of 4

Hybrid View

  1. #1
    SitePoint Enthusiast
    Join Date
    Feb 2007
    Posts
    42
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Set-Cookie and JavaScript

    Pardon me if this has more to do with HTTP than JavaScript but it's JavaScript where I'm having the problem.

    My server sends something like:
    Code:
    Set-Cookie: foo=bar
    and in my JavaScript code I try to access document.cookie but it doesn't exist. I can set cookies in my JavaScript and get them back but the Set-Cookie doesn't seem to have any effect. I've Googled every thing I can think of an all the pages I've found talk about Set-Cookie and PHP or Perl or something. I'm not sure I should expect to see the cookie but I think so. Am I missing something? (If it matters, I'm using Firefox 2.0.0.4, I have no warnings or errors during page loading, and the DOM Inspector shows no cookies.) Any insight appreciated...

  2. #2
    SitePoint Evangelist
    Join Date
    Apr 2006
    Location
    Halifax, Canada
    Posts
    498
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    When you go into your privacy settings and view the cookies, is it there? I know you said you didn't see the cookie in the DOM inspector but the DOM inspector does not show cookies.

    What server-side language are you using?
    Paul Butler.org
    JSSpamBlock - Reduce WordPress spam.

  3. #3
    SitePoint Enthusiast
    Join Date
    Feb 2007
    Posts
    42
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Quote Originally Posted by paulgb View Post
    When you go into your privacy settings and view the cookies, is it there? I know you said you didn't see the cookie in the DOM inspector but the DOM inspector does not show cookies.
    Well, the DOM Inspector _did_ show them for another page so I figured it would show them for this one, too. But when I go into Privacy Settings, I do see the cookie. Strange...

    What server-side language are you using?
    C; I'm writing my own mini-server for an embedded system.

  4. #4
    SitePoint Evangelist
    Join Date
    Apr 2006
    Location
    Halifax, Canada
    Posts
    498
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Quote Originally Posted by Chris.Nelson View Post
    Well, the DOM Inspector _did_ show them for another page so I figured it would show them for this one, too. But when I go into Privacy Settings, I do see the cookie. Strange...
    Ah, I see what you mean, in the JavaScript object explorer. That is odd... It is possible on newer browsers to send a cookie that is not accessible to JavaScript, but your header would not do that. Perhaps it is a path issue? I haven't had much contact directly with the HTTP protocol, so you probably know more about this than I do.
    Paul Butler.org
    JSSpamBlock - Reduce WordPress spam.


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
  •