HELP: extracting JSESSIONID from document.cookie

What is the industry standard/professional way to extract JSESSIONID=SESSION from document.cookie?
so that finally SESSION is var "session_id"?

Pretty much so that most possible browsers are supported and fail safe...

Thank you very much...
Who is Participating?
archrajanConnect With a Mentor Commented:
in client side u can read cookies
u probably need the readcookie() function from here

InGearXAuthor Commented:
Thank you archrajan;

I have found it at:
function readCookie(name)
      var nameEQ = name + "=";
      var ca = document.cookie.split(';');
      for(var i=0;i < ca.length;i++)
            var c = ca[i];
            while (c.charAt(0)==' ') c = c.substring(1,c.length);
            if (c.indexOf(nameEQ) == 0) return c.substring(nameEQ.length,c.length);
      return null;

So I guess I call it as: readCookie("JSESSIONID") ?

PS forgot to post in original file:
(Actual code that examples a practical working solution is obviously the best solution...)
I have cooked up a 'home' solution, but and will post it regardlessly later to admire or laugh at, but am looking for professional answer/solution...
>>>but am looking for professional answer/solution...

There is no other professional answer/solution
You have to read the cookies with a javascript function.. and that is how its done...
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.