title: Checking login status at client side
body: <p>I want to learn what is the best practice to check login status at client side. What I am trying to do is checking user's login status and if he is not logged in open popup box (login box) using JavaScript.</p>
  
  <p>I can think of 2 options</p>
  
  <ol>
  <li>Make an AJAX call to server and get the login status.</li>
  <li>Have a variable in your HTML page and check this variable with
  JavaScript at client side. Of course I do not trust this check, I
  still have all the necessary checks in my controllers at server
  side.</li>
  </ol>
  
  <p>Option 1 is good but it can add some latency/delay so it may not be the best option in terms of user experience. Or am I wrong, with a good server (I am planning to use amazon web services) this delay will be so minimum and user will not understand it (Question may look silly but this is my first web development so please be understandable :))</p>
  
  <p>I can't see any problem with option 2, please correct me if I am wrong. As I said I am trying to understand the best practice.</p>