#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: |
Description
Browser affected: Mozilla/5.0 (Macintosh; U; Intel Mac OS X 10.5; en-GB; rv:1.9.2.13) 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:
$.ajax({ 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 { out.append(xhr.responseText); } console.log('complete ', arguments); } });
Steps to reproduce:
- Save a local copy of the test case: https://gist.github.com/837428
- Load the jquery-ajax-callback-test.html in the browser via the file: protocol.
- Check the result.html content is displayed.
- 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
Component: | unfiled → ajax |
---|---|
Milestone: | 1.next → 1.5.1 |
Priority: | undecided → low |
Resolution: | → duplicate |
Status: | new → closed |
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)