Created
June 25, 2016 10:13
-
-
Save cezarypiatek/c47aeb74a5fd31383ed97dfc807258e0 to your computer and use it in GitHub Desktop.
This file contains 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 characters
function getNewTabId(){ | |
return Math.ceil(Math.random()*1000000000).toString(); | |
} | |
function deactivateTabSession(){ | |
} | |
var tabIdKey ="__TAB_ID__"; | |
if(sessionStorage.getItem(tabIdKey) == null) | |
{ | |
var newTabId = getNewTabId(); | |
sessionStorage.setItem(tabIdKey, newTabId); | |
localStorage.setItem(tabIdKey, newTabId); | |
}else if(sessionStorage.getItem(tabIdKey) != localStorage.getItem(tabIdKey)) | |
{ | |
deactivateTabSession(); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment