1

Is there a way to detect when cookies are changed, added, deleted for my domain in the client side javascript- including when cookies are set by a set-cookie header?

A similar question was asked here but the solutions seemed to only worked when cookies were changed in the javascript ex- document.cookie = 'a=7' but not when cookies were set by a server response in the set-cookie header. I would like to listen for when cookies are changed/set by the set-cookie header as well.

Dashiell Rose Bark-Huss
  • 2,173
  • 3
  • 28
  • 48
  • How did "Periodic Polling" at [the question you link](https://stackoverflow.com/a/63952971/1028230) not work for your use case? That method should work no matter how the cookies are set, your process or another. Though there are very few (?) processes other than yours that can set a cookie after page load. Can you explain your use case a bit more? Are you trying to listen to changes in cookies from `XMLHttpRequest`s, etc? – ruffin Dec 05 '22 at 20:14
  • 1
    This was a long time ago but I think it was because the cookie was http only and could not be accessed by javascript. But I can't really remember the use case or if I was just wrong. – Dashiell Rose Bark-Huss Dec 12 '22 at 16:46

0 Answers0