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.)
Syntax
windowObj.onstorage = function() { ... };
Examples
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
The compatibility table on this page is generated from structured data. If you'd like to contribute to the data, please check out https://github.com/mdn/browser-compat-data and send us a pull request.
Update compatibility data on GitHub
| Desktop | Mobile | ||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| Basic support | Chrome ? | Edge Full support Yes | Firefox Full support 45 | IE ? | Opera ? | Safari ? | WebView Android No support No | Chrome Android No support No | Edge Mobile Full support Yes | Firefox Android Full support 45 | Opera Android ? | Safari iOS ? | Samsung Internet Android ? |
Legend
- Full support
- Full support
- No support
- No support
- Compatibility unknown
- Compatibility unknown