WindowEventHandlers.onstorage

Estás leyendo la versión en inglés del artículo porque aún no existe una traducción para este idioma. ¡Ayúdanos a traducir este artículo!

The onstorage property of the WindowEventHandlers mixin is an EventHandler for processing storage events.

The storage event fires when a storage area has been changed in the context of another document.

Syntax

 window.onstorage = functionRef;

Value

functionRef is a function name or a function expression. This function receives a StorageEvent as its sole argument.

Example

This example logs the value for a storage key whenever it changes in another document.

window.onstorage = function(e) {
  console.log('The ' + e.key +
    ' key has been changed from ' + e.oldValue +
    ' to ' + e.newValue + '.');
};

Specifications

Specification Status Comment
HTML Living Standard
The definition of 'onstorage' 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
onstorageChrome 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