Bug Tracker

Opened 12 years ago

Closed 12 years ago

Last modified 12 years ago

#8342 closed bug (duplicate)

Ajax error event fires when correct response received if page is loaded with file: protocol

Reported by: johnhunter Owned by:
Priority: low Milestone: 1.5.1
Component: ajax Version: 1.5
Keywords: Cc:
Blocked by: Blocking:


Browser affected: Mozilla/5.0 (Macintosh; U; Intel Mac OS X 10.5; en-GB; rv: Gecko/20101203 Firefox/3.6.13

Mozilla/5.0 (Macintosh; U; Intel Mac OS X 10_5_8; en-us) AppleWebKit/533.19.4 (KHTML, like Gecko) Version/5.0.3 Safari/533.19.4

Description: When accessing a page in the loacal file system (file: protocol) JQuery-1.5 fires the error callback on Ajax GET request despite receiving a valid response. This problem does not occur over http:, or over file: with JQuery-1.4.x

Relevant section of code to reproduce:

    type: "GET",
    url: 'response.html',
    success: function () {
		console.log('success ', arguments);
    error: function () {
		console.log('error ', arguments);
    complete: function (xhr, status) {
        if (status === 'error' || !xhr.responseText) {
        else {
		console.log('complete ', arguments);

Steps to reproduce:

  1. Save a local copy of the test case: https://gist.github.com/837428
  2. Load the jquery-ajax-callback-test.html in the browser via the file: protocol.
  3. Check the result.html content is displayed.
  4. Examine the console log trace.

Expected result: Response text 'Success' is displayed. Console trace shows both success and complete events fired.

Actual result: No response text displayed. Console trace shows error event fired. Console trace shows complete event fired, passed xhr object contains correct responseText, statusText is an empty string.

Change History (2)

comment:1 Changed 12 years ago by jitter

Component: unfiledajax
Milestone: 1.next1.5.1
Priority: undecidedlow
Resolution: duplicate
Status: newclosed

Thanks for taking the time to contribute to the jQuery project by writing a bug report and providing a test case!

This has already been fixed and will be in jQuery 1.5.1 (you can verify by trying the current 1.5.1rc1)

comment:2 Changed 12 years ago by jitter

Duplicate of #8125.

Note: See TracTickets for help on using tickets.