Dinesh Kumar Ramakrishnan wrote:access with Javascript.
There's absolutely no reason to use JavaScript. Cookies are sent with each browser request, regardless of whether you send an Ajax request.
Whatever server side language you're using, it must have a way to read and write cookies. When a user logs in, you can save their user name in a cookie, and whenever they access any page on your website, you can read the user name from the cookie and use it to authenticate them.
What server side language are you using?