0

Using XMLHttpRequest I would like to send the Cookie to the same domain via ChromeCast custom receiver. I'm using the following code, but when I look at the headers in the Request, the Cookie header does not appear.

Is there a way to send a request using cookies with XMLHttpRequest via ChromeCast?

$.cookie("a", "test",{expires: 7, path: "/"});

var r = new XMLHttpRequest();
r.open('GET', '/api/checksession', true);
r.withCredentials = true;
r.send();

Thanks.

Erkan
  • 11
  • 2

1 Answers1

0

You may refer with this thread which suggested to make sure that the manifest.json permissions are setup properly.

From this documentation, you have to properly set the cross site domain request permission in the manifest.json of your chrome extension. When done properly, the cookies who are already set for the targeted domain will be sent along with the request you are making to that domain.

You have to be especially careful when playing with localhost:port_number. You will need to specify that domain in full in the manifest.json for it to work. I ended up with awkward behaviors when my localhost domain was NOT specify in full.

abielita
  • 13,147
  • 2
  • 17
  • 59
  • Thank you for your response, but it is not a CrossDomain issue because the application send requests to same domain – Erkan Aug 17 '17 at 15:21