user2897132
user2897132

Reputation: 1

Refresh browser tab when other tab closes

Is there a way to refresh a webpage in one browser tab when another tab is closed?

I have a website which provides the status of a number crafts available for use (let's call it my 'status' tab). Next, I have a vb application which reads a member's HID card and launches a website where they proceed to signout a craft (let's call this my 'signout' tab). When they are done, I want to close the 'signup' tab and refresh the 'status' tab.

Ideally, I would like to have something like - on the last page of the signout process, determine the tab id of the 'status' tab, refresh it, and auto-close the 'signout' tab

Upvotes: 0

Views: 2525

Answers (1)

BaBL86
BaBL86

Reputation: 2622

You can detect tabs, opened by your tab (popup)

function closeCallback() {
    //your code here
}

var openTab = function(uri, name, options, closeCallback) {
    var win = window.open(uri, name, options);
    var interval = window.setInterval(function() {
        try {
            if (win == null || win.closed) {
                window.clearInterval(interval);
                closeCallback(win);
            }
        }
        catch (e) {
        }
    }, 1000);
    return win;
};

Upvotes: 2

Related Questions