I have two domains on different hostings, domain A is the main website, domain B is the authorization server with simple frontend. I have very strict security policy applied, which forces the users after 1 hour to re-authorize themselves. It's done by popup window in new tab, calling domain B from the frontend of the domain A. I realized that the popup blocking policy and the fact, that not every browser behave the same, i found the only solution to bring the popup correctly (in the new tab) by this javascript call (when the timer reaches 60mins):
Object.assign(document.createElement('a'), { target: '_blank', href: 'https://domain_B/auth.php'}).click();
My problem is, that i am unable to check from the domain A, if the popup window is opened correctly and the user haven't closed it. So i need to assign a variable to the new popup tab and check if it's still available, otherwise i need to re-open it from the domain A.
So i want to do something like this:
if(popup_win && !popup_win.closed)
{ //do my auth stuff
}
the problem is, that i am unable to assign the new popup to popup_win javascript variable. I can do it by calling a single window.open(url,"_blank") but as i mentioned above, the result then depends on popup-blockers and browser version/type.
Any help/suggestion appreciated!