WindowEventHandlers.onstorage
The onstorage
property of the
WindowEventHandlers
mixin is an event handler for
processing storage
events.
The storage
event fires when a storage area has been changed in the
context of another document.
Value
A function name or a function expression. This function receives a StorageEvent
as its sole argument.
Examples
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 |
---|
HTML Standard # handler-window-onstorage |
Browser compatibility
BCD tables only load in the browser