LooPer
LooPer

Reputation: 1479

Monitor cookie creation

I am investigating where a cookie is being set but I am not be able to find where. I cannot see it in HTTP headers so I suppose it is being created via Javascript. Is there any way to monitor where/when a cookie is set?

Upvotes: 3

Views: 2501

Answers (2)

JAAulde
JAAulde

Reputation: 19560

Install The Firebug extension to Firefox, then install the Firecookie plugin (Firecookie blog entry). FireCookie adds a panel to Firebug to show you cookie activity.

When looking at the list of cookies, if you right click on one and check Break on '[cookie name]' change, then whenever the cookie changes (if it is a change initiated by a script) Firebug will halt execution of the page and switch panels to the Script panel with the script/line which made the change highlighted for you. If it doesn't ever break, even though you see the cookie change, then the cookie was not modified by a script.

Upvotes: 4

J. K.
J. K.

Reputation: 8368

If you don't see them it in HTTP headers, you need to look for document.cookie in the JavaScript files included in the page.

A cookie is set by assigning a new value to document.cookie.

document.cookie = 'name=value;domain=.example.com;path=/;expires=...';

Upvotes: -3

Related Questions