cancel
Showing results for 
Search instead for 
Did you mean: 

retrieve jsession id in javascript

0 Kudos

Hello, we need to include a beacon js in all of the pages to father some data and one of the parameters in JS is jsession Id.

Wanted to know if there is a way for JS to retrieve jsession id. We are running B2C on hybris 1808.

Thanks,

Accepted Solutions (0)

Answers (2)

Answers (2)

christoph_probst
Active Participant
0 Kudos

Hi,

the JSESSIONID cookie is http only. Hence, you can not read it from java script this is due to security reasons (session hijacking). Also adding the sessionid to a form or request can introduce a vulnerability to your webpage.

Maybe a token or something like that would be more suitable for your use case.

rohit31_raj92
Active Participant
0 Kudos

Can you try first getting the jSessionId in controller of that page or any handler and then pass the same to jsp (using model attribute) and put it in hidden field with some id and then get the value of the hidden field for the id in js.

Please let me know if this help