Friday, December 6, 2019

Communication between 2 tabs using jQuery

//tab 1 
var ch = new BroadcastChannel('true');
    ch.postMessage(true);

    // tab 2
    //ch = new BroadcastChannel('true');
    ch.addEventListener('message', function (e) {
        console.log('Message:', e.data);
        isActive = e.data;
        //alert(e.data);
    }); 

No comments:

Post a Comment