चर्चा » विकास

Sending cookies with GM_xmlhttpRequest

§
पोस्ट केले: 2022-05-23

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

§
पोस्ट केले: 2022-05-24

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。