Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

sessionStorage between parent and child pop-up

I have an HTML5 page where I store some data with:

 window.sessionStorage.setItem('toStore', 'hello world');

Then, I open from this window a pop-up one with:

 window.open('mobile.html', 'myPopUp');

I have a set of Javascript functions associated to the two pages, where I want to access the local storage data of parent page from the popUp with the getItem('toStore') call. Is that possible? If yes, what's the calling syntax? Thanks

like image 451
Ginger Opariti Avatar asked Dec 29 '25 02:12

Ginger Opariti


1 Answers

Converting comment to answer.

window.opener.sessionStorage.setItem('toStore', 'hello world');
like image 179
BNL Avatar answered Dec 30 '25 17:12

BNL



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!