JSFiddle - React, Tailwind, and code Playground

by NickU

HTML

<button class="openPopActBtn">Open pop window </button>

JavaScript

var checkWindow = false;
var fbAuthWindow;
$('.openPopActBtn').click(function(){
    openFBAuth('http://www.google.com');
});
function openFBAuth(url) {
    fbAuthWindow=window.open(url);
    checkWindow = true;
    setTimeout(function() { checkAuthWindow('fb'); }, 1000);
}
function checkAuthWindow(win){
    if(checkWindow == true){
        if(win == 'fb'){
            if(fbAuthWindow.closed){
                window.location.reload();
            } else {
                setTimeout(function() { checkAuthWindow('fb'); }, 1000);    
            }
        }       
    }
}