onerror event
[This documentation is preliminary and is subject to change.]
Raised when there is an error that prevents the completion of the cross-domain request.
![]() |
Syntax
| HTML Attribute | <element onerror = "handler(event)"> |
|---|---|
| Event Property | object.onerror = handler; |
| attachEvent Method | object.attachEvent("onerror", handler) |
Standards information
There are no standards that apply here.
Event information
| Synchronous | No |
|---|---|
| Bubbles | No |
| Cancelable | No |
Event handler parameters
This method has no parameters.
Remarks
The document can respond to the error, but there is no way to determine the cause or nature of the error.
The onerror event does not occur when the ontimeout event occurs.
To invoke this event, do one of the following:
- Cannot invoke. The onerror event occurs when the request could not be completed because of an error.
Examples
Setting the onerror property.
<script type="text/javascript">
function err()
{
alert("XDR onerror");
}
...
xdr.onerror = err;
See also
- XDomainRequest
- XDomainRequest Constructor
- Reference
- onload
- onprogress
- Conceptual
- XMLHttpRequest Enhancements in Internet Explorer 8
Build date: 2/14/2012
Community Content
Ant0ni0 Fernandes
+1
Yes, I noticed this, I am using a web service, and on error it returns the error code and status 500, in firefox and company is working properly bu in IE9 I can't get the responseText. Any clue?
imacomber
responseText in onerror()
I'm noticing that the responseText field in my XDomainRequest object is empty when it enters the "onerror()" event handler path. I have confirmed that my web server has the "Access-Control-Allow-Origin" header value set to "*".
$0$0
$0
$0Additionally, I have confirmed through Fiddler that my web service is actually providing a response text value, which is either hidden / ignored by IE 8 / IE 9 in the onerror event.$0
$0$0
$0
$0Any else ever notice this?$0
