onstorage
特性为
WindowEventHandlers
混合
EventHandler
为处理
storage
事件。
storage
event fires when a storage area has been changed in the context of another document.
window.onstorage = functionRef;
functionRef
is a function name or a
函数表达式
. This function receives a
StorageEvent
as its sole argument.
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 + '.');
};
| 规范 | 状态 | 注释 |
|---|---|---|
|
HTML 实时标准
The definition of 'onstorage' in that specification. |
实时标准 |
| 桌面 | 移动 | |||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|
onstorage
|
Chrome 1 | Edge ≤18 | Firefox 45 | IE ? | Opera 15 | Safari ? | WebView Android ≤37 | Chrome Android 18 | Firefox Android 45 | Opera Android 14 | Safari iOS ? | Samsung Internet Android 1.0 |
完整支持
兼容性未知