How do I read the value of a cookie that comes with a cross domain image?

68 views Asked by At

I've called an image that's on another domain. It's a captcha image and it comes with a cookie with a code in it that I need to be able to access in my javascript. When I view the GET request in Google dev tools I can see the cookie, it's name and value. However I can't seem to get access to it in my javascript. I need the code to send back with a request. How do I do this? From devtools: Set-Cookie captchaCookie=54497581448a....

1

There are 1 answers

0
Quentin On BEST ANSWER

You can't.

Information about data loaded from other origins is not generally available to JavaScript.

If you need to get the information from the cookie, then you would be better off writing some code to run on the domain serving it that provides it in the body of a text or JSON file and uses CORS to give you permission to access it.