get cookie after set cookie

Posted by user1432779 on Stack Overflow See other posts from Stack Overflow or by user1432779
Published on 2012-12-02T10:54:38Z Indexed on 2012/12/02 11:03 UTC
Read the original article Hit count: 228

Filed under:
|
|

I've set my cookie using set-cookie as follows on the server's cgi scripts

print """Content-type: text/html\r\n""",
print """Set-Cookie: name=value\r\n\r\n""",

but when I reload the page I can't get the cookie as it doesn't appear on

document.cookie

How do I get the cookies? and was Set-cookie : name=value supposed to appear on document.cookie after I refresh the page?

Overall I want the client side to recognize the cookie if exists and act accordingly

Thanks

© Stack Overflow or respective owner

Related posts about JavaScript

Related posts about cookies