Secure context

This feature is available only in secure contexts (HTTPS), in some or all supporting browsers.

The onchange EventHandler of the CookieStore interface fires when a change is made to any cookie.


CookieStore.onchange = function() { ... }
CookieStore.addEventListener('change', function() { ... })


In this example we listen for changes using the onchange event handler.

cookieStore.onchange = function() {
    console.log('1 change event');

In this example we listen for changes using addEventListener().

cookieStore.addEventListener('change', (event) => {
  console.log('1 change event');


Specification Status Comment
Cookie Store API
The definition of 'CookieStore.onchange' in that specification.
Draft Initial definition.

Browser compatibility

BCD tables only load in the browser