Bug Tracker

Modify

Ticket #8125 (closed bug: fixed)

Opened 3 years ago

Last modified 3 years ago

jQuery 1.5 Local File AJAX requests are "not successful" despite working fine in 1.4.4

Reported by: samuel@… Owned by: jaubourg
Priority: high Milestone: 1.5.1
Component: ajax Version: 1.5
Keywords: Cc:
Blocking: Blocked by:

Description (last modified by jitter) (diff)

Loading  file:// results in the error callback.

At line 7251, I put a breakpoint, here is the contents of xhr:

XMLHttpRequest
onabort: null
onerror: null
onload: null
onloadstart: null
onprogress: null
onreadystatechange: function () {}
readyState: 4
responseText: "//	This file is part of the "jQuery.Syntax" project, and is licensed under the GNU AGPLv3. //	Copyri…"
responseXML: null
status: 0
statusText: ""
upload: XMLHttpRequestUpload
withCredentials: false
__proto__: XMLHttpRequestPrototype

Despite being successful, on line 6430, because status is 0, the request is considered failed.

Change History

comment:1 Changed 3 years ago by anonymous

N.B. running exactly the same code from a web server results in the correct code being executed, I guess because status will be 200.

comment:2 Changed 3 years ago by anonymous

N.B. I've verified this problem with both Safari 3 and FF 3.6.12

comment:3 Changed 3 years ago by anonymous

Sorry, I meant Safari 5 ... getting old :)

comment:4 Changed 3 years ago by rwaldron

  • Owner set to jaubourg
  • Priority changed from undecided to high
  • Status changed from new to assigned
  • Component changed from unfiled to ajax

comment:5 Changed 3 years ago by anonymous

I just double checked and yes, 1.4.4 works fine in the same situation.

comment:6 Changed 3 years ago by jaubourg

  • Milestone changed from 1.next to 1.5.1

comment:7 Changed 3 years ago by jaubourg

  • Status changed from assigned to closed
  • Resolution set to fixed

Fixes #8125. Status is set to 200 for requests with status 0 when location.protocol if "file:". Added test/localfile.html to control it works.

Changeset: cb85da7b62e74e7339ed652ade209aaffbd0c15b

comment:8 Changed 3 years ago by danheberden

#8127 is a duplicate of this ticket.

comment:9 Changed 3 years ago by jitter

  • Description modified (diff)

comment:10 Changed 3 years ago by rwaldron

#8166 is a duplicate of this ticket.

comment:11 Changed 3 years ago by jitter

#8154 is a duplicate of this ticket.

comment:12 follow-up: ↓ 13 Changed 3 years ago by Yun Mo

Another problem occurs when inserting html code by ajaxing from local file as follows though no problem occurs with http.

Node cannot be inserted at the specified point in the hierarchy" code: "3 error source line: [Break On This Error] fragment.appendChild( ret[i] ); jquery-git.js (line 5605)

Yun

comment:13 in reply to: ↑ 12 Changed 3 years ago by jitter

Replying to Yun Mo:

Another problem occurs when inserting html code by ajaxing from local file as follows though no problem occurs with http.

Node cannot be inserted at the specified point in the hierarchy" code: "3 error source line: [Break On This Error] fragment.appendChild( ret[i] ); jquery-git.js (line 5605)

Yun

Please provide a reduced test case, which reproduces the issue you are experiencing. Also make sure to read the link given below, in order to provide a most useful bug report.


 How to report bugs

comment:14 Changed 3 years ago by jitter

#8342 is a duplicate of this ticket.

Please follow the  bug reporting guidlines and use  jsFiddle when providing test cases and demonstrations instead of pasting the code in the ticket.

View

Add a comment

Modify Ticket

Action
as closed
Author


E-mail address and user name can be saved in the Preferences.

 
Note: See TracTickets for help on using tickets.