Created
March 11, 2021 22:18
-
-
Save jesus2099/b4d8584d761c42c43da8d0cf3e5d2a62 to your computer and use it in GitHub Desktop.
Origin is null in Greasemonkey https://github.com/greasemonkey/greasemonkey/issues/3111
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// ==UserScript== | |
// @name httpbin.org/post XMLHttpRequest Origin header test | |
// @description Origin is null in Greasemonkey https://github.com/greasemonkey/greasemonkey/issues/3111 | |
// @version 1 | |
// @author jesus2099 | |
// @grant none | |
// @match *://httpbin.org/* | |
// ==/UserScript== | |
var xhr = new XMLHttpRequest(); | |
xhr.addEventListener("load", function(event) { | |
alert(this.responseText); | |
}); | |
xhr.open("POST", location.protocol + "//" + location.host + "/post", true); | |
xhr.setRequestHeader("Content-Type", "application/x-www-form-urlencoded"); | |
setTimeout(function() { xhr.send("toto=1&tutu=bob"); }, 1000); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment