JSFiddle - React, Tailwind, and code Playground

by Abhisek DasGupta

HTML

<a onclick="test();">link</a>

JavaScript

function test() {
    var authorizationRequestURL = "https://cloudsso.cisco.com/as/authorization.oauth2?response_type=code&client_id=eReaderAuthProd&scope=%20openid%20profile%20email%20phone";

    var callbackLoginURL = "https://learningspace.cisco.com/?code=";

    var win = window.open(authorizationRequestURL, '_blank', 'location=no,zoom=no,clearcache=yes,clearsessioncache=no');

    win.addEventListener('load', function(event) {
        console.log("load --" ,event.target.URL)
    });
    win.addEventListener('unload', function(event) {
        console.log("unload --" , event);

        setTimeout(function(){ 
            console.log("unload --",event);
        	//win.close(); // will be called when matches with callbackLoginURL
          
         }, 3000);
        
    });

    win.addEventListener('onbeforeunload', function(event) {
       
        console.log("onbeforeunload --", event);
    });
    win.addEventListener('pagehide', function(event) {
        console.log("pagehide --" ,event)
    });
    if (document.readyState === "loading") {

        win.addEventListener('DOMContentLoaded', function(event) {
            console.log("DOMContentLoaded --", event)
        });
    }
}