Reply to Re: Send cookie to server?

Your name:

Reply:


Posted by Benjamin Niemann on 03/31/06 22:01

Martin wrote:

> How can I send a cookie (that was created by client-side scripting) to
> the server?
>
> It's my understanding that if the cookie had been created by the
> server, it would be automatically submitted when a request is sent to
> that server. Is it possible to achieve this same behavior with a
> cookie that was not created by the server?

The cookie gets sent to the server (on subsequent requests), which sent the
document. You may have to specify the 'path' parameter (which defaults to
the directory of the document), if the document is in a subdirectory and
the cookie should be sent to documents in another directory. E.g. cookie
created in /foo/doc1 and /bar/doc2 should recieve it. By default only
documents in /foo will get the cookie.
If you want the cookie to be sent to a document on another domain, you also
have to specify the 'domain' parameter.

document.cookie = 'foobar=this is the value; path=/; domain=www.example.com'

--
Benjamin Niemann
Email: pink at odahoda dot de
WWW: http://pink.odahoda.de/

[Back to original message]


Удаленная работа для программистов  •  Как заработать на Google AdSense  •  England, UK  •  статьи на английском  •  PHP MySQL CMS Apache Oscommerce  •  Online Business Knowledge Base  •  DVD MP3 AVI MP4 players codecs conversion help
Home  •  Search  •  Site Map  •  Set as Homepage  •  Add to Favourites

Copyright © 2005-2006 Powered by Custom PHP Programming

Сайт изготовлен в Студии Валентина Петручека
изготовление и поддержка веб-сайтов, разработка программного обеспечения, поисковая оптимизация