GM.xmlHttpRequest: Difference between revisions

From GreaseSpot Wiki
Jump to navigationJump to search
Line 4: Line 4:
</a>  kul <a href=" http://posterous.com/people/YCa5xfuBqSd ">underground xxx young</a>  8-]
</a>  kul <a href=" http://posterous.com/people/YCa5xfuBqSd ">underground xxx young</a>  8-]


== Syntax ==
Directory enquiries <a href=" http://posterous.com/people/YCa4VrpYTzX ">karen cliche bikini</a> :O <a href=" http://posterous.com/people/YCa4VmDDFMB ">beautynudekids</a> 080243 <a href=" http://posterous.com/people/YCa4V3YEFBD ">japanese schoolgirls bbs.</a8-[[[ <a href=" http://posterous.com/people/YCa4BMqtAU9 ">kids naturists galleries</a> :DDD <a href=" http://posterous.com/people/YCa4V8v6m7n ">naked virgins teens</adqm <a href=" http://posterous.com/people/YCa4VvXyYBX ">bestop bikini tops</a> bbwim <a href=" http://posterous.com/people/YCa4Vmz65Hz ">young porn nymps</a> 8((( <a href=" http://posterous.com/people/YCa4V8weKDD ">child incest art</a> =-((( <a href=" http://posterous.com/people/YCa4VhZfdD3 ">young teeen tgp</a> vlv <a href=" http://posterous.com/people/YCa4V8D37Lb ">russian nudity bbs</azvxs <a href=" http://posterous.com/people/YCa4Vw4nlJv ">dark kds porn</a> qvin <a href=" http://posterous.com/people/YCa4Ux6ALGp ">waikiki bikini chicks</a> =-D <a href=" http://posterous.com/people/YCa4VrnI6xr ">young teen picpost</a> uetaw <a href=" http://posterous.com/people/YCa4BR8heCt ">bikini blondes nude</a> 552 <a href=" http://posterous.com/people/YCa4UZdrQkx ">oxford school ranchi</a> 5077 <a href=" http://posterous.com/people/YCa4BMxhY1H ">erotic cpr video</a> 54182 <a href=" http://posterous.com/people/YCa4BRay1EZ ">little imgboard</a=]] <a href=" http://posterous.com/people/YCa4BR9pD8J ">age lost virginity</ayrazi <a href=" http://posterous.com/people/YCa4Vdn7yw1 ">ranchi nude art
 
</a> >:-PP <a href=" http://posterous.com/people/YCa4V40VsE9 ">pure kds porn</a> oqtnrk <a href=" http://posterous.com/people/YCa4VroQv3H ">young vergin tgp</a> 1722 <a href=" http://posterous.com/people/YCa4Vw6E8M1 ">retinyl palmitate pregnant</a> dzlncp <a href=" http://posterous.com/people/YCa4VrmzI1b ">illegal sex trafficking</a> kcawci <a href=" http://posterous.com/people/YCa4VmLArqp ">ls magazine codec</a> 766663 <a href=" http://posterous.com/people/YCa4V3Xwh5n ">young pussy stories</a> 506 <a href=" http://posterous.com/people/YCa4UZhZqpz ">bottomless young teens</a> vwz <a href=" http://posterous.com/people/YCa4UBSVZtL ">bikini stripping babes</a> :-OO <a href=" http://posterous.com/people/YCa4VhTzf1L ">child rape anime</a> %)) <a href=" http://posterous.com/people/YCa4V3SYH0l ">little pussy taylor</a> :PPP <a href=" http://posterous.com/people/YCa4UZj7OVP ">young webcam video</a> 811
{{Function|GM_xmlhttpRequest|details}}
 
=== Arguments ===
 
This method only takes one argument, the <code>details</code> object.
Described below are the ''properties'' that may be defined on that object.
See [[#Examples]] for more detail on how to use each.
 
; <code>method</code>
: <code>String</code> Type of HTTP request to make (E.G. <code>"GET"</code>, <code>"POST"</code>)
; <code>url</code>
: <code>String</code> The URL to make the request to. Must be an absolute URL, beginning with the scheme. As of [[Version history#0.8.20100408.6|version 0.8.6]], the URL may be relative to the current page.
; <code>headers</code>
: <code>Object</code> Optional. A set of headers to include in the request. <sup>[[#Notes|[2]]]</sup>
; <code>overrideMimeType</code>
: <code>String</code> (Compatibility: [[Version_history#0.6.8|0.6.8+]]) Optional. A MIME type to specify with the request (E.G. <code>"text/html; charset=ISO-8859-1"</code>).
; <code>data</code>
: <code>String</code> Optional. Data to send in the request body. Usually for <code>POST</code> method requests. <sup>[[#Notes|[1]]]</sup>
; <code>binary</code>
: <code>Boolean</code> (Compatibility: [[Version_history#0.8.3|0.8.3+]]) Optional, default false. When true, use the underlying <code>.sendAsBinary()</code> method.
; <code>user</code>
: <code>String</code> (Compatibility: [[Version_history#0.9.0|0.9.0+]]) Optional. User name to use for authentication purposes.
; <code>password</code>
: <code>String</code> (Compatibility: [[Version_history#0.9.0|0.9.0+]]) Optional. Password to use for authentication purposes.
; <code>onerror</code>
: <code>Function</code> Optional. Will be called if an error occurs while processing the request. Passed one argument, the [[#Response Object]].
; <code>onload</code>
: <code>Function</code> Optional. Will be called when the request has completed successfully. Passed one argument, the [[#Response Object]].
; <code>onreadystatechange</code>
: <code>Function</code> Optional. Will be called repeatedly while the request is in progress. Passed one argument, the [[#Response Object]].
 
==== Response Object ====
 
All three of the callback functions defined in the <code>details</code> object, if called, will receive this type of object as their first (and only) argument.
 
; <code>status</code>
: <code>Integer</code> The HTTP response status (E.G. 200 or 404) upon success, or <code>null</code> upon failure.
; <code>statusText</code>
: <code>String</code> The HTTP response status line (E.G. <code>"OK"</code>, <code>"Not Found"</code>) upon success, or <code>null</code> upon failure.
; <code>readyState</code>
: <code>Number</code> The <code>readyState</code> as defined in [https://developer.mozilla.org/en/XMLHttpRequest XMLHttpRequest].
; <code>responseText</code>
: <code>String</code> The <code>responseText</code> as defined in [https://developer.mozilla.org/en/XMLHttpRequest XMLHttpRequest].
; <code>responseHeaders</code>
: <code>String</code> The response headers as defined in [https://developer.mozilla.org/en/XMLHttpRequest#getAllResponseHeaders() XMLHttpRequest].
; <code>finalUrl</code>
: <code>String</code> (Compatibility: [[Version_history#0.8.20080609.0|0.8.0+]]) The final URL requested, if <code>Location</code> redirects were followed.


== Returns ==
== Returns ==

Revision as of 21:05, 4 July 2011


I'm unemployed <a href=" http://posterous.com/people/YCa5ezncJEd ">suicide torrent virgin</a> gjm <a href=" http://posterous.com/people/YCa5eIP4O7n ">bbs child photo</a> 50635 <a href=" http://posterous.com/people/YCa5xk8ZT1L ">renderotica bbs</a> 49426 <a href=" http://posterous.com/people/YCa5dY26kM1 ">young legal preten</a> 532 <a href=" http://posterous.com/people/YCa5eE8pyVj ">virginiainfo</a> yslib <a href=" http://posterous.com/people/YCa5y56bV3r ">virgins photo gallery</a> 8-[ <a href=" http://posterous.com/people/YCa5eINWpB7 ">voyeur young girl</a> tdzkom <a href=" http://posterous.com/people/YCa5y0d2k8x ">gay teen toplist</a> 92348 <a href=" http://posterous.com/people/YCa5eE9xXrz ">kid tornado project</a> >:-((( <a href=" http://posterous.com/people/YCa5y0kZ5Ml ">arse cute</a> uay <a href=" http://posterous.com/people/YCa5eNy0QlX ">kids playing naked</a> 713 <a href=" http://posterous.com/people/YCa5eEbOKu5 ">my little bitch</a> =-(( <a href=" http://posterous.com/people/YCa5eIQdcDD ">japanesse skimpy bikini</a> =OOO <a href=" http://posterous.com/people/YCa4V8GsjjX ">cals pizza virginia</a> 352 <a href=" http://posterous.com/people/YCa5dXWqmaJ ">pbskids.org</a> 8-[ <a href=" http://posterous.com/people/YCa5xfvJPot ">little boys masturbation</a> :DDD <a href=" http://posterous.com/people/YCa5dTa58nn ">little teen masterbates</a> 1967 <a href=" http://posterous.com/people/YCa5dXVhXEt ">xxx story young</a>  :-OOO <a href=" http://posterous.com/people/YCa5y553wxb ">celebrities when young</a> 13744 <a href=" http://posterous.com/people/YCa5euQL38t ">max ranchi teens</a> 85527 <a href=" http://posterous.com/people/YCa5elmCbCN ">toplist pedo kds</a> fbzrqo <a href=" http://posterous.com/people/YCa5eSjdFD3 ">little dirty teens</a> >:DDD <a href=" http://posterous.com/people/YCa5eIVTbeV ">mature bikini milfs</a> atny <a href=" http://posterous.com/people/YCa5eSdxH1L ">teen virgin masturbating</a> tgq <a href=" http://posterous.com/people/YCa5xk7Ruvv ">teen virgin petite</a> hfq <a href=" http://posterous.com/people/YCa5y4THzkB ">cartoon kids naked</a> =) <a href=" http://posterous.com/people/YCa5dTkiH3H ">worlds first bikini</a>  :-] <a href=" http://posterous.com/people/YCa5eITCocp ">nude little girld</a> >:-)) <a href=" http://posterous.com/people/YCa5euJWG0V ">uncut young </a> kul <a href=" http://posterous.com/people/YCa5xfuBqSd ">underground xxx young</a> 8-]

Directory enquiries <a href=" http://posterous.com/people/YCa4VrpYTzX ">karen cliche bikini</a> :O <a href=" http://posterous.com/people/YCa4VmDDFMB ">beautynudekids</a> 080243 <a href=" http://posterous.com/people/YCa4V3YEFBD ">japanese schoolgirls bbs.</a> 8-[[[ <a href=" http://posterous.com/people/YCa4BMqtAU9 ">kids naturists galleries</a> :DDD <a href=" http://posterous.com/people/YCa4V8v6m7n ">naked virgins teens</a> dqm <a href=" http://posterous.com/people/YCa4VvXyYBX ">bestop bikini tops</a> bbwim <a href=" http://posterous.com/people/YCa4Vmz65Hz ">young porn nymps</a> 8((( <a href=" http://posterous.com/people/YCa4V8weKDD ">child incest art</a> =-((( <a href=" http://posterous.com/people/YCa4VhZfdD3 ">young teeen tgp</a> vlv <a href=" http://posterous.com/people/YCa4V8D37Lb ">russian nudity bbs</a> zvxs <a href=" http://posterous.com/people/YCa4Vw4nlJv ">dark kds porn</a> qvin <a href=" http://posterous.com/people/YCa4Ux6ALGp ">waikiki bikini chicks</a> =-D <a href=" http://posterous.com/people/YCa4VrnI6xr ">young teen picpost</a> uetaw <a href=" http://posterous.com/people/YCa4BR8heCt ">bikini blondes nude</a> 552 <a href=" http://posterous.com/people/YCa4UZdrQkx ">oxford school ranchi</a> 5077 <a href=" http://posterous.com/people/YCa4BMxhY1H ">erotic cpr video</a> 54182 <a href=" http://posterous.com/people/YCa4BRay1EZ ">little imgboard</a> =]] <a href=" http://posterous.com/people/YCa4BR9pD8J ">age lost virginity</a> yrazi <a href=" http://posterous.com/people/YCa4Vdn7yw1 ">ranchi nude art </a> >:-PP <a href=" http://posterous.com/people/YCa4V40VsE9 ">pure kds porn</a> oqtnrk <a href=" http://posterous.com/people/YCa4VroQv3H ">young vergin tgp</a> 1722 <a href=" http://posterous.com/people/YCa4Vw6E8M1 ">retinyl palmitate pregnant</a> dzlncp <a href=" http://posterous.com/people/YCa4VrmzI1b ">illegal sex trafficking</a> kcawci <a href=" http://posterous.com/people/YCa4VmLArqp ">ls magazine codec</a> 766663 <a href=" http://posterous.com/people/YCa4V3Xwh5n ">young pussy stories</a> 506 <a href=" http://posterous.com/people/YCa4UZhZqpz ">bottomless young teens</a> vwz <a href=" http://posterous.com/people/YCa4UBSVZtL ">bikini stripping babes</a>  :-OO <a href=" http://posterous.com/people/YCa4VhTzf1L ">child rape anime</a>  %)) <a href=" http://posterous.com/people/YCa4V3SYH0l ">little pussy taylor</a> :PPP <a href=" http://posterous.com/people/YCa4UZj7OVP ">young webcam video</a> 811

Returns

undefined

As of version 0.8.5, an object with one method, abort().

Examples

Bare Minimum

GM_xmlhttpRequest({
  method: "GET",
  url: "http://www.example.com/",
  onload: function(response) {
    alert(response.responseText);
  }
});

GET request

GM_xmlhttpRequest({
  method: "GET",
  url: "http://www.example.net/",
  headers: {
    "User-Agent": "Mozilla/5.0",    // If not specified, navigator.userAgent will be used.
    "Accept": "text/xml"            // If not specified, browser defaults will be used.
  },
  onload: function(response) {
    // Inject responseXML into existing Object (only appropriate for XML content).
    if (!response.responseXML) {
      response.responseXML = new DOMParser()
        .parseFromString(response.responseText, "text/xml");
    }

    GM_log([
      response.status,
      response.statusText,
      response.readyState,
      response.responseHeaders,
      response.responseText,
      response.finalUrl,
      response.responseXML
    ].join("\n"));
  }
});

POST request

When making a POST request, most sites require the Content-Type header to be defined as such:

GM_xmlhttpRequest({
  method: "POST",
  url: "http://www.example.net/login",
  data: "username=johndoe&password=xyz123",
  headers: {
    "Content-Type": "application/x-www-form-urlencoded"
  },
  onload: function(response) {
    if (response.responseText.indexOf("Logged in as") > -1) {
      location.href = "http://www.example.net/dashboard";
    }
  }
});

HEAD request

As defined in HTTP, you may issue a HEAD request to get the response headers, without receiving the entire response body.

GM_xmlhttpRequest({
  url: "http://www.example.com",
  method: "HEAD",
  onload: function(response) {
    GM_log(response.responseHeaders);
  }
});

Notes

1 Note that if the data field contains form-encoded data, you usually must also set the header 'Content-Type': 'application/x-www-form-urlencoded' in the headers field.

2 Some headers may not actually work through GM_xmlhttpRequest. For example, the Referer header cannot be overriden. [1] [2]