Greasy Fork is available in English.

Обговорення » Розробка

Sending cookies with GM_xmlhttpRequest

§
Опубліковано: 23.05.2022

How do I send a cookie with GM_xmlhttpRequest?

I tried

 GM_xmlhttpRequest({
   method: "GET",
   url: "url",
   headers: {
    "Content-Type": "application/json",
    "Cookie": "example=1234"
   },
   onload: function(response) {
        console.log(response.responseText)
   }
  });

but it doesn't seem to set the cookie to that

§
Опубліковано: 24.05.2022

https://developer.mozilla.org/en-US/docs/Web/API/XMLHttpRequest/withCredentials

https://localcoder.org/how-do-i-set-a-cookie-header-with-xmlhttprequest-in-javascript

Even if those work you might still face a Cors issue anyway, in most places online I've mostly seen people just saying that this is not possible with xmlhttpRequest.

Опублікувати відповідь

Sign in to post a reply.