Bug Tracker

Opened 10 years ago

Closed 8 years ago

#13806 closed feature (migrated)

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

Reported by: [email protected] Owned by: [email protected]
Priority: low Milestone: None
Component: ajax Version: 1.9.1
Keywords: Cc: jaubourg
Blocked by: Blocking:

Description

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).

http://jsfiddle.net/MFmnu/

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 10 years ago by dmethvin

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

comment:2 Changed 10 years ago by dmethvin

Cc: jaubourg added

comment:3 Changed 10 years ago by [email protected]

@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 10 years ago by Timmy Willison

Component: unfiledajax
Owner: set to [email protected]
Priority: undecidedlow
Status: newassigned
Type: bugfeature

comment:6 Changed 8 years ago by m_gol

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