Bug Tracker

Opened 7 years ago

Closed 6 years ago

#13806 closed feature (migrated)

JSONP error handler for cross origin requests is triggered only after timeout

Reported by: ri.joel@… Owned by: ri.joel@…
Priority: low Milestone: None
Component: ajax Version: 1.9.1
Keywords: Cc: jaubourg
Blocked by: Blocking:


The JSONP error handler is triggered for HTTP errors (e.g. 404) for same origin requests immediately, but for cross origin requests only after the timeout occurred. This can be easily fixed with adding script.onerror (see Zepto.js).


Tested browsers: Affected: Chrome 26, Firefox 20, Safari 6, Opera 12.14 Not affected: IE 9

I will provide a patch later.

Change History (6)

comment:1 Changed 7 years ago by dmethvin

Are you still interested in providing a patch? How widespread is .onerror support in XHR?

comment:2 Changed 7 years ago by dmethvin

Cc: jaubourg added

comment:3 Changed 7 years ago by ri.joel@…

@dmethvin, yes, but I am quite busy at the moment. I think script.onerror together with script.onreadystatechange covers the most browsers, but I am not sure about Opera. I found out that it is already fixed in jQuery 2. The reason why it works for same origin requests is that it uses XMLHttpRequest internally (altough the format is JSONP).

comment:4 Changed 7 years ago by timmywil

Component: unfiledajax
Owner: set to ri.joel@…
Priority: undecidedlow
Status: newassigned
Type: bugfeature

comment:6 Changed 6 years ago by m_gol

Resolution: migrated
Status: assignedclosed
Note: See TracTickets for help on using tickets.