Diskussionen » Entwicklung

Sending cookies with GM_xmlhttpRequest

§
Veröffentlicht: 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

§
Veröffentlicht: 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.

Antwort schreiben

Anmelden um eine Antwort zu senden.

长期地址
遇到问题?请前往 GitHub 提 Issues。