The WindowEventHandlers.onstorage property contains an event handler that runs when the storage event fires. This occurs when a storage area is changed (e.g. a new item is stored.)


windowObj.onstorage = function() { ... };


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 AndroidiOS SafariSamsung 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: sideshowbarker, fscholz, erikadoyle, teoli, chrisdavidmills
Last updated by: sideshowbarker,