I am trying reopen the existing window from different windows
For example ,
Inside window one, I am opening page one and on that page I have button, upon on click of that button I am opening another window with the name "Connect" using following code
var connectWin = window.open("url to Connect page","Connect", "status=no,toolbar=no,menubar=no,location=no,directories=no,top=0,left=900,width=800,height=750");
connectWin.name="Connect";
Now, in the same window one, I am traversing to different page (within same domain) and on this page I have another button and upon on click I am checking whether connect window is already open or not if yes, then I open the existing window otherwise thow an error
// code to take reference of an existing connect window
var connectWnd = window.open('', 'Connect');
if( jQuery.type(connectWnd) === "undefined" || connectWnd.location.href === 'about:blank' ){
connectWnd.close();
$("#errorMessage").text("Connect page is not opened yet");
}else{
//if connect is already open then post a message to that window
connectWnd.postMessage(data);
}
The issue that i am facing is , if user open another page in a different window than I alway get Connect Page is not opened yet error.
It seems when user tries to access the page from different window i.e. window two than in that case window.open('', 'Connect'); fails. So is there a way to open an existing window from any window in the browser.