Gin*_*iti 2 javascript html5 local-storage
我有一个HTML5页面,我在其中存储一些数据:
window.sessionStorage.setItem('toStore', 'hello world');
Run Code Online (Sandbox Code Playgroud)
然后,我从这个窗口打开一个弹出窗口:
window.open('mobile.html', 'myPopUp');
Run Code Online (Sandbox Code Playgroud)
我有一组与这两个页面关联的Javascript函数,我想通过getItem('toStore')调用从popUp访问父页面的本地存储数据.那可能吗?如果是,那么调用语法是什么?谢谢
将评论转换为答案.
window.opener.sessionStorage.setItem('toStore', 'hello world');
Run Code Online (Sandbox Code Playgroud)