I want to check if the user is authenticated before accessing private pages of my app. 
The plan is to write a script at the top of every page that downloads the jquery, connect to the server and check the connection and redirect the user to login page if he/she is not logged in. 

For example, this is the private.html page

```
    <script src="/js/jquery"> //put a function that will till the download is completed before  running  the liness below
    <script>
        $.ajax(ur:"/server/checkif user is logged");

     </script>   

     //other html elements

```