Given two codes, both trying to trigger server to give back of downloadable file using http header in response i.e. "Content-Disposition", "attachment; filename=filename.ext:
-
Using form,
$('<form></form>').attr('href', path) ... .submit().remove(); -
Using ajax,
$.ajax(url, config);
I would like to know why browsers handle that differently, since form and ajax are not quite different in term of sending request and receiving servers responses. I have search around, but nothing is convincing.
PS: I'm aware of CROS, but in this case cross domain is not an issue here.
Aucun commentaire:
Enregistrer un commentaire