gpt4 book ai didi

http-equiv 上的 Javascript Hook ="refresh"

转载 作者:行者123 更新时间:2023-12-02 19:09:41 25 4
gpt4 key购买 nike

我使用以下元 header 以便在打开页面时下载文件:

<meta http-equiv="refresh" content="3;URL=SomeFileName" />

有没有办法让一些 JavaScript 代码在 3 秒过去后运行,即在浏览器开始下载 SomeFileName 之前?

最佳答案

您可以使用 setTimeout() 来计时,但正如评论中所述,在这种情况下最好使用 JavaScript 进行重定向。示例:

setTimeout(function(){
/*
* code here will be executed before the download
*/
document.location = "downloadurl";
}, 3000); // 3000ms = 3s

关于http-equiv 上的 Javascript Hook ="refresh",我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/13901262/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com