Συζητήσεις » Ανάπτυξη

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.

Δημοσίευση απάντησης

Συνδεθείτε για να δημοσιεύσετε μια απάντηση.

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