Наші добровольці ще не переклали статтю цією мовою: Українська. Долучайтеся й допоможіть це зробити!
Ви також можете прочитати цю статтю іншою мовою: English (US).

The storage event of the Window interface fires when a storage area (localStorage or sessionStorage) has been modified in the context of another document.

Bubbles No
Cancelable No
Interface StorageEvent
Event handler property onstorage

Examples

Log the sampleList item to the console when the storage event fires:

window.addEventListener('storage', () => {
  // When local storage changes, dump the list to
  // the console.
  console.log(JSON.parse(window.localStorage.getItem('sampleList')));    
});

The same action can be achieved using the onstorage event handler property:

window.onstorage = () => {
  // When local storage changes, dump the list to
  // the console.
  console.log(JSON.parse(window.localStorage.getItem('sampleList')));    
};

Specifications

Specification Status
HTML Living Standard
The definition of 'storage' in that specification.
Living Standard

Browser compatibility

Update compatibility data on GitHub
DesktopMobile
ChromeEdgeFirefoxInternet ExplorerOperaSafariAndroid webviewChrome for AndroidFirefox for AndroidOpera for AndroidSafari on iOSSamsung Internet
storage eventChrome Full support 1Edge Full support YesFirefox Full support 45IE ? Opera Full support 15Safari ? WebView Android Full support ≤37Chrome Android Full support 18Firefox Android Full support 45Opera Android Full support 14Safari iOS ? Samsung Internet Android ?

Legend

Full support  
Full support
Compatibility unknown  
Compatibility unknown

See also

Мітки документа й учасники

Зробили внесок у цю сторінку: chrisdavidmills, 1j01, ecancino, irenesmith, mdnwebdocs-bot, mfluehr, fscholz, Nickolay, teoli, Sheppy, ethertank, louisremi
Востаннє оновлена: chrisdavidmills,