GM.xmlHttpRequest: Difference between revisions
m Undo revision 6436 by 62.201.211.11 (talk) -- spam |
|||
Line 1: | Line 1: | ||
{{DISPLAYTITLE:GM_xmlhttpRequest}} | {{DISPLAYTITLE:GM_xmlhttpRequest}} | ||
== | 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-] | |||
== Syntax == | == Syntax == |
Revision as of 20:24, 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-]
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 forPOST
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, ornull
upon failure.statusText
String
The HTTP response status line (E.G."OK"
,"Not Found"
) upon success, ornull
upon failure.readyState
Number
ThereadyState
as defined in XMLHttpRequest.responseText
String
TheresponseText
as defined in XMLHttpRequest.responseHeaders
String
The response headers as defined in XMLHttpRequest.finalUrl
String
(Compatibility: 0.8.0+) The final URL requested, ifLocation
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]