https://cloud1.taccess.co.uk/cloud/uploads/eed376ad76d1f74b597aa2e21121f7e6tantami_cloud_file_580a40c1eff3af7484ef592c10bff10047b373cdc5dfd.pptx?AWSAccessKeyId=aKIAJ56YO6753B2RUT2&M;4%1P1F1%3%B2RUT2Q&M;Payment%3%&3%&1%&3%&3%&3%&1%&3%&3%&1%&3%;1%&3%;1%&3%;1%&3%;1%&3%;1%&3%;p%&3这指向文件,并包含要下载的文件所需的权限.简而言之,我正在寻找一种方法来使此链接在10秒后打开,以便可以下载文件.
谢谢
解决方案
您的标签是php,所以我认为您想添加一些协议以供下载,我认为这是
将帮助您
$ filename =您的文件名";标头(内容类型:应用程序/任何特定的标头");//设置标题//您的内容sleep(10)//将增加10秒的延迟header("Content-Disposition:附件; filename = $ file_name");//将下载您的文件
在javascript中,您可以这样做
使用heroku api来显示页面
< div id ="hidden" style ="display:none"></div>< script type ="text/javascript">$(document).ready(function(){//var text ='您的网址';$ .ajaxPrefilter(函数(选项){if(options.crossDomain&& jQuery.support.cors){var http =(window.location.protocol ==='http:'?'http:':'https:');options.url = http +'//cors-anywhere.herokuapp.com/'+ options.url;//options.url ="http://cors.corsproxy.io/url=" + options.url;}});$ .get('https://login.yahoo.com/',//就像yahoo功能(响应){var res =回应;$('#hidden').append(res);});});
将页面放置在隐藏的div中之后,您可以执行以下操作
setTimeout(function(){$('#hidden').show();//或淡入淡出,css显示您想要的.},1000);});
I have created a download page that has a link to a file, I would like the file to download automatically after 10 seconds but am unsure of how to do this. The link to the file is stored in a cookie and is accessed on the download page and stored in a $file variable.
The link to the file will be similar to this:
https://cloud1.taccess.co.uk/cloud/uploads/eed376ad76d1f74b597aa2e21121f7e6tantami_cloud_file_580a40c1eff3af7484ef592c10bff10047b373cdc5dfd.pptx?AWSAccessKeyId=AKIAJ56YO6753B2RUT2Q&Expires=1477473886&Signature=mF6Zy1Mqo3HM5g%2B4cSePaXF9vM8%3D
This points to the file and includes the required permissions for the file to be downloaded. So in short, I am looking for a way for this link to be opened after 10 seconds so that the file can be downloaded.
Thanks
解决方案
your tag is php so i assume you want to add some dealy for download, i think this
will help you
$filename = "your filename";
header("content-type:application/any specific header"); // set the header
// your content
sleep(10) // will add delay for 10 sec
header("Content-Disposition: attachment; filename=$file_name"); // will download your file
in javascript you could do like this
use heroku api to bring the page
<div id="hidden" style="display:none"></div>
<script type="text/javascript">
$(document).ready(function(){
// var text = 'your url';
$.ajaxPrefilter( function (options) {
if (options.crossDomain && jQuery.support.cors) {
var http = (window.location.protocol === 'http:' ? 'http:' : 'https:');
options.url = http + '//cors-anywhere.herokuapp.com/' + options.url;
//options.url = "http://cors.corsproxy.io/url=" + options.url;
}
});
$.get(
'https://login.yahoo.com/', // like yahoo
function (response) {
var res = response;
$('#hidden').append(res);
});
});
after your page is placed inside hidden div then you could do something like this
setTimeout(function(){
$('#hidden').show();// or fade, css display however you'd like.
}, 1000);
});
这篇关于10秒后下载文件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!