Dims
Dims

Reputation: 51239

How to catch cookie change/disappear in browser debug tools?

I have cookie disappearing in my webapp when it shouldn't (expring date is a year ahead).

Can I set breakpoint on cookie change or something?

Upvotes: 2

Views: 2600

Answers (1)

Sebastian Zartner
Sebastian Zartner

Reputation: 20125

In Firebug you had the chance to stop the JavaScript execution on cookie changes. The current DevTools don't provide such a feature yet.

For Firefox it is requested in https://bugzil.la/895893, and I've just requested to add it to Chrome's DevTools in https://bugs.chromium.org/p/chromium/issues/detail?id=1171347.

What you can do right now is to search through the code within the Debugger to find the places where the cookies are changed.

To do that, you have to

  1. Switch to the Debugger panel
  2. Press Ctrl+Shift+F to search within all files
  3. Enter document.cookie and hit Enter
  4. Set a breakpoint for each found statement setting this variable

As there's currently only this way to add, remove or change cookies in JavaScript, this should allow you to find the place where the cookie you're searching is removed.

Upvotes: 5

Related Questions