Created
September 27, 2023 14:36
-
-
Save manikantag/273a57e1ab011515a07c4a5dbd3677fc to your computer and use it in GitHub Desktop.
Revisions
-
manikantag created this gist
Sep 27, 2023 .There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,16 @@ const tabCheckBroadcast = new BroadcastChannel("TAB_CHECK"); tabCheckBroadcast.postMessage("FIRST_TAB"); tabCheckBroadcast.onmessage = (event) => { if (event.data === "FIRST_TAB") { tabCheckBroadcast.postMessage("FIRST_TAB_OPENED"); } if (event.data === `FIRST_TAB_OPENED`) { alert("You are not supposed to duplicate the tab"); //disableApp(); } }; function disableApp() { document.body.classList.add("disable"); document.getElementById('maskApp').style.display = 'block'; }