Skip to content

Instantly share code, notes, and snippets.

@arantius
Created August 5, 2011 15:45
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save arantius/1127807 to your computer and use it in GitHub Desktop.
Save arantius/1127807 to your computer and use it in GitHub Desktop.
GM_xhr with progress test
// ==UserScript==
// @name GM_xhr with progress test
// @namespace https://github.com/arantius
// @include http://localhost*
// ==/UserScript==
dump('>>> GM_xhr test starting.\n');
var xhr = GM_xmlhttpRequest({
method: "GET",
url: "http://localhost/slow.php",
onload: function(response) { dump('<<< onload!\n'); },
onreadystatechange: function(response) { dump('<<< onreadystatechange!\n'); },
onprogress: function(response) { dump('<<< onprogress!\n'); },
onerror: function(response) { dump('<<< onerror!\n'); },
onabort: function(response) { dump('<<< onabort!\n'); },
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment