user5858
user5858

Reputation: 1221

Unable to access cookie value

After clearing my browser history when I go to this URL: http://indianvisa-bangladesh.nic.in/visa/index.html

then I click on "Get Appointment" green link which takes us to http://indianvisa-bangladesh.nic.in/visa/Appointment_Login.jsp

Here it sets a JSESSIONID cookie. I can see this cookie in both Firefox/Chrome developer tools but can't access it using document.cookie in console.

When I type document.cookie; it shows empty string.

How do I print it?

Edit: Also this JSESSIONID cookie has Path value of "/visa"

enter image description here

Upvotes: 4

Views: 3305

Answers (1)

Parag Bhayani
Parag Bhayani

Reputation: 3330

The reason behind you can't read this cookie is because it is HTTPOnly Cookie, So if you are developer then you can set it easily false in your code when you are creating it. otherwise you can't get it using javascript. This is specifcally a feature rather than a bug provided by all major browsers.

See below for HTTP flag enter image description here

More references: SOQuestion1, SOQuestion2, SOQuestion3

Upvotes: 6

Related Questions