HTTP Cookies created by Javascript
Question:
My site has Google analytics (each page includes urchin.js), but when I use the Chilkat HTTP component, I don’t see the cookies. I can see the cookies using FireFox. What’s the problem?
Answer:
Cookies may be sent by the server via the Set-Cookie header. Chilkat HTTP looks for this header in the HTTP response and collects the cookies. It is also possible for Javacript code to set a cookie in a browser. When a browser receives HTML, it loads it into an HTML DOM (Document Object Model) and then runs any embedded Javascript. The urchin.js contains Javascript that creates one or more cookies. The Chilkat HTTP component does not build an in-memory DOM, and does not run Javascript, therefore, if a cookie is created in Javascript, it cannot be seen by Chilkat HTTP.
You may examine the HTTP request and response headers by checking the Chilkat HTTP LastHeader and LastReponseHeader properties, as shown in this example:
ASP: Examine HTTP Request and Response Headers
SQL Server: Examine HTTP Request and Response Headers
C#: Examine HTTP Request and Response Headers
C++: Examine HTTP Request and Response Headers
MFC: Examine HTTP Request and Response Headers
C: Examine HTTP Request and Response Headers
Delphi: Examine HTTP Request and Response Headers
Visual FoxPro: Examine HTTP Request and Response Headers
Java: Examine HTTP Request and Response Headers
Perl: Examine HTTP Request and Response Headers
PHP: Examine HTTP Request and Response Headers
Python: Examine HTTP Request and Response Headers
Ruby: Examine HTTP Request and Response Headers
VB.NET: Examine HTTP Request and Response Headers
Visual Basic: Examine HTTP Request and Response Headers
VBScript: Examine HTTP Request and Response Headers