Comment
Willem
Tera Sage

For me using the User Session solved this. Just to be sure I also included

if ((window.name !== 'gsft_main') || (window.parent.document.URL.indexOf("login.do") > -1)) {
        console.log("Prevent popup in this window or on this page.");
        return;
    }

But I don't think that is even needed.