I have created Login page, based on localStorage. On loading the page I have checked the value of localStorage. If I opened the web page in more than one tab and then I logo
"localStorage persists any saved data indefinitely on the user's computer and across browser tabs" Source
This means that if you empty / remove the login data you've set in one tab, the data will be changed in all other tabs as well.
So, if the user logs out, localStorage data changes.
Then, on your tabs, detect when a user changes focus to that tab again using the onfocus event:
function onFocus(){
//Reload Page if logged out (Check localStorage)
window.location.reload();
};
if (/*@cc_on!@*/false) { // check for Internet Explorer
document.addEventHandler("focusin", onFocus);
} else {
window.addEventHandler("focus", onFocus);
}
Source
This means you won't be constantly running javascript, or reloading (a possibly large amount of) tabs at the same time.