The HttpRequest API implements a subset of the W3C XmlHttpRequest specification, and makes it available in both workers and the main HTML page.
Since the browser's XmlHttpRequest object is not available in the context of a worker, Gears provides its own HttpRequest object to fill that need. Gears HttpRequest provides most of the features of XmlHttpRequest except for the ability to access the response as an XML DOM object and the ability to send a request synchronously.
Does not require user permission.
<script type="text/javascript" src="gears_init.js"></script>
<script type="text/javascript">
var request = google.gears.factory.create('beta.httprequest');
request.open('GET', '/index.html');
request.onreadystatechange = function() {
if (request.readyState == 4) {
console.write(request.responseText);
}
};
request.send();
</script>
HttpRequest class
void open(method, url)
void setRequestHeader(name, value)
void send([postData])
void abort()
string getResponseHeader(name)
string getAllResponseHeaders()
callback onprogress(progressEvent)
callback onreadystatechange()
readonly attribute int readyState
readonly attribute Blob responseBlob
readonly attribute string responseText
readonly attribute int status
readonly attribute string statusText
readonly attribute HttpRequestUpload upload
HttpRequestUpload class
callback onprogress(progressEvent)
ProgressEvent class
readonly attribute int total
readonly attribute int loaded
readonly attribute bool lengthComputable
abort()voidgetAllResponseHeaders()stringgetResponseHeader(headerName)stringheaderNameopen(method, url)voidmethodurlThe method parameter can have a value of "GET", "POST", "HEAD" or another HTTP method listed in the W3C specification.
The URL parameter may be either a relative or complete URL and must be from the same origin as the current context.
send([postData])voidpostData - an optional string or Blob to be sent as the body of a POST or PUT request.setRequestHeader(name, value)voidname - the HTTP header to setvalue - the value of the headercallback onprogress(progressEvent)progressEvent - A ProgressEvent object.callback onreadystatechange()callback onprogress(progressEvent)progressEvent - A ProgressEvent object.You are viewing a mobilized version of this site...
View original page here