This page is Ready to Use

Notice: The WebPlatform project has been discontinued when the Stewards partnership agreement ended in September 2015. This site has been frozen, and the assets we have created will remain.



Returns or sets the number of milliseconds a request can take before automatically being terminated.

Property of apis/xhr/XMLHttpRequestapis/xhr/XMLHttpRequest


var result = element.timeout;
element.timeout = value;

Return Value

Returns an object of type unsigned longunsigned long


// The following example sets the timeout property

var xhr = new XMLHttpRequest();"GET", "http://localhost/books.xml", true);
xhr.timeout = 10000;
xhr.ontimeout = timeoutFired;


The timeout property has a default value of 0. If the time-out period expires, the responseText property will be null. You should set a time-out value that is slightly longer than the expected response time of the request. The timeout property may be set only in the time interval between a call to the open method and the first call to the send method. If you set an XMLHttpRequest time-out value that is larger than the network stack’s time-out value, the network stack will time out first and the ontimeout event will not be raised.

Related specifications

W3C XMLHttpRequest Specification
W3C Working Draft