We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
第461天 sessionStrorage也可以使用onstorage事件吗?
3+1官网
我也要出题
The text was updated successfully, but these errors were encountered:
可以 https://developer.mozilla.org/zh-CN/docs/Web/API/WindowEventHandlers/onstorage
Sorry, something went wrong.
<!DOCTYPE html> <html lang="en"> <head> <meta charset="UTF-8"> <meta name="viewport" content="width=device-width, initial-scale=1.0"> <meta http-equiv="X-UA-Compatible" content="ie=edge"> <meta name="renderer" content="webkit"> <title>Document</title> <style> button { width: 200px; height: 40px; border: none; background-color: aqua; } </style> </head> <body> <button id='local'>设置localStorage</button> <button id='session'>设置sessionStorage</button> </body> </html> <script type="text/javascript"> window.onstorage = function (e) { console.log(e.key + ' 键已经从 ' + e.oldValue + ' 改变为 ' + e.newValue + '.'); }; document.querySelector('#local').addEventListener('click', () => { localStorage.setItem('local', Math.random()) }); document.querySelector('#session').addEventListener('click', () => { sessionStorage.setItem('session', Math.random()) }); </script>
No branches or pull requests
第461天 sessionStrorage也可以使用onstorage事件吗?
3+1官网
我也要出题
The text was updated successfully, but these errors were encountered: