I need to upload a file with the Content-Disposition header , which is set by the server to " attachment". I use jQuery.ajaxfor GET, and when deleting - hidden iframe src- urlwhich gives me a pop-up window for downloading the file. And it works fine in all browsers. Now I want to change my own request headers to encrypt the file before GET and download. For this, I used jQuery.ajaxthe request callback function beforeSend.
I can get my encrypted file, which I can watch in firebug, but mine iframestill shows an unencrypted file to load. After checking, I can say that it is iframerequesting a new GET.
the code
$.ajax({
url: "/tutorial.text",
beforeSend: function(xhr) { xhr.setRequestHeader("PASSWORD_HEADER", userPwd); },
success: function() { $("#Hidden_iframe").attr("src", this.url); }
});
And it works well in Internet Explorer. How can I make an iframe use an available resource, rather than request a new GET. Or how can I setRequestHeader in an iframe, or do I really need jQuery.ajaxfor this task, is there a better way to load the Content-Disposition header, which is installed in the attachment files directly from the server.
source
share