我有一个 HTML5 页面,我在其中存储了一些数据:
window.sessionStorage.setItem('toStore', 'hello world');
然后,我从这个窗口打开一个弹出窗口:
window.open('mobile.html', 'myPopUp');
我有一组与这两个页面关联的 Javascript 函数,我想在其中使用 getItem('toStore')
调用从弹出窗口访问父页面的本地存储数据。
那可能吗?如果是,调用语法是什么?
谢谢
最佳答案
将评论转换为答案。
window.opener.sessionStorage.setItem('toStore', 'hello world');
关于javascript - 父子弹窗之间的sessionStorage,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/7556214/