Opened 10 years ago
Closed 9 years ago
#13965 closed bug (cantfix)
ajax request never completes if user downloads a file
Reported by: | Owned by: | jaubourg | |
---|---|---|---|
Priority: | low | Milestone: | None |
Component: | ajax | Version: | 2.0.0 |
Keywords: | Cc: | ||
Blocked by: | Blocking: |
Description
When doing an ajax request that takes a long time to complete, if the user clicks a link to download a file and stays on the same webpage, the ajax request never raises an event like done, error, complete, etc
To repro this bug, I need a long standing request on server side and I don't know how to repro on JSFiddle but here is a Visual Studio solution, just download ajaxSend.zip
https://skydrive.live.com/?cid=8dce4b0da74046fc&id=8DCE4B0DA74046FC%21653&authkey=!AOoPQze7o_V-D4w
Change History (12)
comment:1 Changed 10 years ago by
Owner: | set to [email protected]… |
---|---|
Status: | new → pending |
comment:2 Changed 10 years ago by
Status: | pending → new |
---|
I have hosted the application on this URL: http://signalr01.cloudapp.net:82/
Now, your repro code is minimal, only the HTML and JS available on the browser :)
comment:3 Changed 10 years ago by
Status: | new → pending |
---|
I'm sorry but I can't reproduce it. Here's a test case on jsFiddle:
http://jsfiddle.net/5YGVB/1/
http://jsfiddle.net/5YGVB/1/show/light/ (a standalone test without iframes)
I used a web page http://mgol.eu/sandboxes/longwait/ I've just created. Its whole code is:
<?php sleep(6); header('Access-Control-Allow-Origin: *'); header('Content-Type: application/json'); echo '{"a":2}'; ?>
You can use this page for your tests if you want but we do need a test case on jsFiddle to be able to investigate. If your problem require a different response, I can update the PHP test but you can also do it on your own server; just remember to set the Access-Control-Allow-Origin header to * or jsFiddle won't be able to start an AJAX request against this page.
comment:4 Changed 10 years ago by
Status: | pending → new |
---|
Use a word document as the file to download. I can repro the issue when the link is created as "<a href". The issue goes away when the link is created as "<a download href".
"download" keyword is HTML5 so it works only on latest browsers.
comment:5 Changed 10 years ago by
So does this problem happen with all browsers? What OS are you using?
comment:6 Changed 10 years ago by
OK, I can reproduce it, situation is as follows (I changed the test case to not use the download attribute):
1) Chrome & Safari fail the test
2) on Firefox always
& fail
fire.
3) on IE10 always
& done
fire.
I'm unable to test IE9 in this way because it doesn't support CORS.
http://jsfiddle.net/5YGVB/2/show/light/
Thanks for your report, gustavo!
comment:8 Changed 10 years ago by
Component: | unfiled → ajax |
---|---|
Owner: | changed from [email protected]… to m_gol |
Priority: | undecided → low |
Status: | new → assigned |
comment:9 Changed 9 years ago by
Owner: | changed from m_gol to jaubourg |
---|
jaubourg claims it's not possible to fix this one without re-introducing all the logic from 1.x.
Reassigning to jaubourg so that he can close the bug as wontfix if he wishes.
comment:10 Changed 9 years ago by
@jaubourg, can you provide some more background about why this happens? I assume it has something to do with our switch from onreadystatechange
?
comment:11 Changed 9 years ago by
It's a browser issue. Clicking on a link will abort outbound requests. The fact this is a download link is irrelevant. On mobile Safari, for instance, downloads will be on a new page. Fact is, browsers will abort early, before they know if an actual in-place navigation will occur.
Of course, this behavior is not 2.x specific.
comment:12 Changed 9 years ago by
Resolution: | → cantfix |
---|---|
Status: | assigned → closed |
Oh that makes sense, and it's something we can't control.
That's way too much code. Can you provide a simple test case that doesn't require external libraries? Even if it's just a standalone file. Otherwise, it's likely that the problem is caused by one of the other things in the file. See also #13883 which seems to be reporting the same problem, but also was too large/unclear.