The onstorage property of the WindowEventHandlers mixin is the EventHandler for processing storage events. These events fire when a storage area is changed (e.g., a new item is stored.)


 window.onstorage = function(event) { ... };


This example logs the value for a key whenever it changes.

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


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

Browser compatibility

Update compatibility data on GitHub
ChromeEdgeFirefoxInternet ExplorerOperaSafariAndroid webviewChrome for AndroidEdge MobileFirefox for AndroidOpera for AndroidSafari on iOSSamsung Internet
Basic supportChrome ? Edge Full support YesFirefox Full support 45IE ? Opera ? Safari ? WebView Android No support NoChrome Android No support NoEdge Mobile Full support YesFirefox Android Full support 45Opera Android ? Safari iOS ? Samsung Internet Android ?


Full support  
Full support
No support  
No support
Compatibility unknown  
Compatibility unknown

Document Tags and Contributors

Contributors to this page: mfluehr, sideshowbarker, fscholz, erikadoyle, teoli, chrisdavidmills
Last updated by: mfluehr,