CookieStore.onchange
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.
Syntax
CookieStore.onchange = function() { ... } CookieStore.addEventListener('change', function() { ... })
Examples
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'); });
Specifications
Specification |
---|
Cookie Store API # dom-cookiestore-onchange |
Browser compatibility
Desktop | Mobile | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|
Chrome | Edge | Firefox | Internet Explorer | Opera | Safari | WebView Android | Chrome Android | Firefox for Android | Opera Android | Safari on IOS | Samsung Internet | |
onchange |
87 |
87 |
No |
No |
73 |
No |
87 |
87 |
No |
62 |
No |
14.0 |
© 2005–2021 MDN contributors.
Licensed under the Creative Commons Attribution-ShareAlike License v2.5 or later.
https://developer.mozilla.org/en-US/docs/Web/API/CookieStore/onchange