I want to abort XHR request on timeout event, but it's not working. Syntax is next:
var req = new XMLHttpRequest();
req.open('POST', url , true);
req.timeout = 5000;
req.ontimeout = function () {
req.abort();
};
So if XHR request is not finished in 5 seconds code should abort request. If I only write req.abort(), XHR request will perform.