W3cubDocs

/Web APIs

CookieChangeEvent: CookieChangeEvent() constructor

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

Experimental: This is an experimental technology
Check the Browser compatibility table carefully before using this in production.

The CookieChangeEvent() constructor creates a new CookieChangeEvent object which is the event type passed to CookieStore.onchange(). This constructor is called by the browser when a change event occurs.

Note: This event constructor is generally not needed for production websites. It's primary use is for tests that require an instance of this event.

Syntax

js

new CookieChangeEvent(type)
new CookieChangeEvent(type, options)

Parameters

type

A string with the name of the event. It is case-sensitive and browsers always set it to cookiechange.

options Optional

An object that, in addition of the properties defined in Event(), can have the following properties:

changed

An array containing the changed cookies.

deleted

An array containing the deleted cookies.

Return value

A new CookieChangeEvent object.

Specifications

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
CookieChangeEvent 87 87 No No 73 No 87 87 No 62 No 14.0

© 2005–2023 MDN contributors.
Licensed under the Creative Commons Attribution-ShareAlike License v2.5 or later.
https://developer.mozilla.org/en-US/docs/Web/API/CookieChangeEvent/CookieChangeEvent