InGearX
asked on
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...
so that finally SESSION is var "session_id"?
Pretty much so that most possible browsers are supported and fail safe...
Thank you very much...
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
>>>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...
There is no other professional answer/solution
You have to read the cookies with a javascript function.. and that is how its done...
ASKER
I have found it at: http://www.quirksmode.org/js/cookies.html
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,
}
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...