从 HTTPS 站点下载 HTTP 文件
我正在尝试从未安装 SSL 证书 (HTTP) 的远程资源获取文件。用户单击按钮后,它会将一些数据发送到服务器上的 PHP 文件,该文件执行一些操作以创建指向外部资源的链接: http://givememystuff.com/1/2/3/ABCS
然后脚本将链接传递回客户端(JavaScript 和 jQuery),以便客户端下载文件。我最近的尝试是使用下面的代码,该代码在 Chrome 中效果很好。问题是,当它在 Edge 中运行时,MS 会阻止下载,因为它来自 HTTP 位置。
对我哪里出错有什么想法吗?
complete: function(xhr) {
if(xhr.status == 200) {
var data = xhr.responseText;
// console.log(data);
window.open(data);
} else {
console.log(xhr);
alert("Unable to pull Document");
}
I am attempting to get a file from a remote resource that does not have an SSL Certificate installed (HTTP). Once the user clicks the button, it sends some data to a PHP file on the server which performs some manipulation to create a link to the external resource: http://givememystuff.com/1/2/3/ABCS
The script then passes the link back to the client (JavaScript with jQuery) for the client to download the file. My latested attempt at getting this to work is using the code below which works great in Chrome. The issue is when this runs in Edge, MS blocks the download because it comes from an HTTP location.
Any thoughts on where I am going wrong?
complete: function(xhr) {
if(xhr.status == 200) {
var data = xhr.responseText;
// console.log(data);
window.open(data);
} else {
console.log(xhr);
alert("Unable to pull Document");
}
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论