Window detection after reboot

so what am i doing this

var myWindow = false;
$('someelement').click(function(){
  var myWindow = window.open('url', 'name', 'width=100,height=200');
});

so that the user clicks on an element in window A and opens a new window (call its window B) ...

but then suppose window A will restart ... because of this, var myWindow is now false ... but then window B is still open ... how can I detect if window B exists from window A after the window A will be rebooted

I know you can do this:

var hasWindow = window.open('', 'name');

and it will return a link to window B if it is already open.

But then, if window B is not already open, instead, it causes the window to open, which is undesirable

How can I get a link to window B if it opens without launching a new window that opens when window B is not open? (without resorting to cookie tricks)

+5
1

LITTLE cookie - - window.name. , JSON, , .

:

var keptState;
if (window.name !== "") {
    keptState = JSON.parse(window.name);
}

:

state = {
    "popupOpened" : true,
    "popupName" : "otherWindowName"
};
window.name = JSON.stringify(state);

( ), , . , , . , . , , , - .

, , . popunder, . , , , , , .

var myWindow = window.open('', 'otherWindowName');
myWindow.blur();
window.focus();
+1

All Articles