I am using
window.open(newTabUrl, "toolbar=yes,scrollbars=yes,resizable=yes", "width=500,height=500");
which is working fine if I did not refresh page.
But I want to maintain this value in one variable and set in the local storage. When I go to another page, if new window is opened I want to refresh that new window when I open new document. This is working if I am in the same page.
I am using this code to set value in the local storage:-
myWindow = window.open(newTabUrl, "toolbar=yes,scrollbars=yes,resizable=yes", "width=500,height=500");
newDocumentWindow = true;
localStorage.setItem("newDocumentWindow", newDocumentWindow);
localStorage.setItem("myWindow", myWindow);
When page is refreshing I am using
var myWindow = localStorage.getItem("myWindow");
It gives me ["object window"]
When I am assigning this code to refresh page like this:
myWindow.location.href = newTabUrl;
myWindow.focus();
It is not working. Please help me how to store window.open value in local storage and get value from local-storage during page refresh.