we are a community of more than 2 million smartest coders
registration for
employee referral programs
are now open
get referred to google, amazon, flipkart and more
register now
  
pinned-register now
showing results for - "how to check if a user is logged in javascript"
Amy
06 Sep 2020
1jQuery(window).load(function() {
2  //Set the login session 
3  sessionStorage.setItem('status','loggedIn') 
4});
5
6//Check the login session
7if (sessionStorage.getItem('status') != null))
8    //redirect to page
9	console.log('You are logged in');
10}
11else{
12    //show validation message
13  console.log('You are not logged in');
14}