TECHNOLOGIES
FORUMS
JOBS
BOOKS
EVENTS
INTERVIEWS
Live
MORE
LEARN
Training
CAREER
MEMBERS
VIDEOS
NEWS
BLOGS
Sign Up
Login
No unread comment.
View All Comments
No unread message.
View All Messages
No unread notification.
View All Notifications
Answers
Post
An Article
A Blog
A News
A Video
An EBook
An Interview Question
Ask Question
Forums
Monthly Leaders
Forum guidelines
Prakash
NA
258
78.6k
Logout all tab for same user
Aug 23 2019 2:33 AM
Hello Experts,
when i am click on logout button in one tab it should be logout all open tab for same user in same browser in angular 7.
I am tried using localstorage below is code but in that case i m getting event on second tab. but i am not able to use same componet method in window.addEventListener.
even i tried document.addEventListener but it is not working.
storageChange() {
localStorage.setItem('logout-event', 'logout' + Math.random());
}
window.addEventListener('storage', function (event) {
// do what you want on logout-event
if (event.key == 'logout-event') {
console.log('Received logout event! Insert logout script here.');
this.localStorage.clear();
this.sessionStorage.clear();
console.log('Received logout event! after clear storage');
}
});
please help me is there any other solution for same.
Thank you
Reply
Answers (
3
)
Angular 8 setup for Visual Studio 2017
drop-down in angularjs