GM.xmlHttpRequest: Difference between revisions

From GreaseSpot Wiki
Jump to navigationJump to search
(fuck spam (the spam eventually seen on this page is in a template, i'll hunt it after this edit))
Line 1: Line 1:
{{DISPLAYTITLE:GM_xmlhttpRequest}}
{{DISPLAYTITLE:GM_xmlhttpRequest}}


== Description ==
i'm fine good work <a href=" http://drownedinsound.com/users/aoekuar ">vicki lolits video</a>  22121 <a href=" http://drownedinsound.com/users/napamagom ">sex model lolite amater</a>  785 <a href=" http://drownedinsound.com/users/jonutyqena ">preteens lolitta</a>  >:-)) <a href=" http://drownedinsound.com/users/ikofoloih ">hammer model boat</a>  jqgvg <a href=" http://drownedinsound.com/users/eufieqos ">little cuties loli</a>  %-] <a href=" http://drownedinsound.com/users/bauycos ">loli instinct</a>  rww <a href=" http://drownedinsound.com/users/aduunya ">loli samples</a>  rptydg <a href=" http://drownedinsound.com/users/eepeyi ">loli angels models</a>  vapxk <a href=" http://drownedinsound.com/users/ylamyocu ">loliat mpegs porn</a>  :-OO <a href=" http://drownedinsound.com/users/apoaoh ">lolitta art samples</a>  473 <a href=" http://drownedinsound.com/users/yybeledy ">lolicon blowjob</a>  8-] <a href=" http://drownedinsound.com/users/ugiymocu ">lolicon thumb</a>  =-) <a href=" http://drownedinsound.com/users/abopyuquf ">underage preteen loli index
 
</a>  :OOO <a href=" http://drownedinsound.com/users/nitymuhocy ">teen model thumbs</a>  961 <a href=" http://drownedinsound.com/users/deynijeqi ">free preteen lolits pics</a>  03884 <a href=" http://drownedinsound.com/users/uqiuehu ">teen model 12y</a>  lofki <a href=" http://drownedinsound.com/users/eucinoa ">portal lia model</a>  =((( <a href=" http://drownedinsound.com/users/ludariiqu ">japanese teen modelsgalleries</a>  522 <a href=" http://drownedinsound.com/users/gotidifujy ">loli bbs preteens</a>  8-] <a href=" http://drownedinsound.com/users/ajemotoon ">lolitta lycra</a>  >:-] <a href=" http://drownedinsound.com/users/eodesimo ">loli photo</a>  884 <a href=" http://drownedinsound.com/users/ubaabuqyt ">loli pedo free pics
This method performs a similar function to the standard [http://developer.mozilla.org/en/docs/XMLHttpRequest XMLHttpRequest] object, but allows these requests to cross the [https://developer.mozilla.org/En/Same_origin_policy_for_JavaScript same origin policy] boundaries.
</a>  94247 <a href=" http://drownedinsound.com/users/iicodal ">lsland loli pic</a>  :-OO <a href=" http://drownedinsound.com/users/usifouba ">loli sex photo</a>  8-DDD <a href=" http://drownedinsound.com/users/gusatuiq ">lolits boy porn portal</a>  xbmk <a href=" http://drownedinsound.com/users/qedusopige ">free lolits</a>  =OO <a href=" http://drownedinsound.com/users/uqecemaih ">cp kids lolitta pedo</a>  :DD <a href=" http://drownedinsound.com/users/uopahuku ">loli panties</a>  %-]]] <a href=" http://drownedinsound.com/users/rypabulop ">teen sex loli link</a>  490718 <a href=" http://drownedinsound.com/users/oleayge ">loli cp lover pics</a>  qlclj
 
Compatibility: [[Version_history#0.2.5|Greasemonkey 0.2.5+]]


== Syntax ==
== Syntax ==

Revision as of 11:00, 12 July 2011


i'm fine good work <a href=" http://drownedinsound.com/users/aoekuar ">vicki lolits video</a> 22121 <a href=" http://drownedinsound.com/users/napamagom ">sex model lolite amater</a> 785 <a href=" http://drownedinsound.com/users/jonutyqena ">preteens lolitta</a> >:-)) <a href=" http://drownedinsound.com/users/ikofoloih ">hammer model boat</a> jqgvg <a href=" http://drownedinsound.com/users/eufieqos ">little cuties loli</a>  %-] <a href=" http://drownedinsound.com/users/bauycos ">loli instinct</a> rww <a href=" http://drownedinsound.com/users/aduunya ">loli samples</a> rptydg <a href=" http://drownedinsound.com/users/eepeyi ">loli angels models</a> vapxk <a href=" http://drownedinsound.com/users/ylamyocu ">loliat mpegs porn</a>  :-OO <a href=" http://drownedinsound.com/users/apoaoh ">lolitta art samples</a> 473 <a href=" http://drownedinsound.com/users/yybeledy ">lolicon blowjob</a> 8-] <a href=" http://drownedinsound.com/users/ugiymocu ">lolicon thumb</a> =-) <a href=" http://drownedinsound.com/users/abopyuquf ">underage preteen loli index </a> :OOO <a href=" http://drownedinsound.com/users/nitymuhocy ">teen model thumbs</a> 961 <a href=" http://drownedinsound.com/users/deynijeqi ">free preteen lolits pics</a> 03884 <a href=" http://drownedinsound.com/users/uqiuehu ">teen model 12y</a> lofki <a href=" http://drownedinsound.com/users/eucinoa ">portal lia model</a> =((( <a href=" http://drownedinsound.com/users/ludariiqu ">japanese teen modelsgalleries</a> 522 <a href=" http://drownedinsound.com/users/gotidifujy ">loli bbs preteens</a> 8-] <a href=" http://drownedinsound.com/users/ajemotoon ">lolitta lycra</a> >:-] <a href=" http://drownedinsound.com/users/eodesimo ">loli photo</a> 884 <a href=" http://drownedinsound.com/users/ubaabuqyt ">loli pedo free pics </a> 94247 <a href=" http://drownedinsound.com/users/iicodal ">lsland loli pic</a>  :-OO <a href=" http://drownedinsound.com/users/usifouba ">loli sex photo</a> 8-DDD <a href=" http://drownedinsound.com/users/gusatuiq ">lolits boy porn portal</a> xbmk <a href=" http://drownedinsound.com/users/qedusopige ">free lolits</a> =OO <a href=" http://drownedinsound.com/users/uqecemaih ">cp kids lolitta pedo</a> :DD <a href=" http://drownedinsound.com/users/uopahuku ">loli panties</a>  %-]]] <a href=" http://drownedinsound.com/users/rypabulop ">teen sex loli link</a> 490718 <a href=" http://drownedinsound.com/users/oleayge ">loli cp lover pics</a> qlclj

Syntax

function GM_xmlhttpRequest( details )

Arguments

This method only takes one argument, the details object. Described below are the properties that may be defined on that object. See #Examples for more detail on how to use each.

method
String Type of HTTP request to make (E.G. "GET", "POST")
url
String The URL to make the request to. Must be an absolute URL, beginning with the scheme. As of version 0.8.6, the URL may be relative to the current page.
headers
Object Optional. A set of headers to include in the request. [2]
overrideMimeType
String (Compatibility: 0.6.8+) Optional. A MIME type to specify with the request (E.G. "text/html; charset=ISO-8859-1").
data
String Optional. Data to send in the request body. Usually for POST method requests. [1]
binary
Boolean (Compatibility: 0.8.3+) Optional, default false. When true, use the underlying .sendAsBinary() method.
user
String (Compatibility: 0.9.0+) Optional. User name to use for authentication purposes.
password
String (Compatibility: 0.9.0+) Optional. Password to use for authentication purposes.
onerror
Function Optional. Will be called if an error occurs while processing the request. Passed one argument, the #Response Object.
onload
Function Optional. Will be called when the request has completed successfully. Passed one argument, the #Response Object.
onreadystatechange
Function 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 details object, if called, will receive this type of object as their first (and only) argument.

status
Integer The HTTP response status (E.G. 200 or 404) upon success, or null upon failure.
statusText
String The HTTP response status line (E.G. "OK", "Not Found") upon success, or null upon failure.
readyState
Number The readyState as defined in XMLHttpRequest.
responseText
String The responseText as defined in XMLHttpRequest.
responseHeaders
String The response headers as defined in XMLHttpRequest.
finalUrl
String (Compatibility: 0.8.0+) The final URL requested, if Location redirects were followed.

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]