单击超链接下载文件后,如何强制用户进入等待页面?

时间:2015-03-03 16:26:17

标签: redirect hyperlink download web

每个用户在点击直接链接之前是否必须等待。例如,他们点击指向mysite.com/downloads/file.zip的链接。如果不进行修改,file.zip将开始下载。我想将用户重定向到等待时间页面。我希望这适用于文件夹中的每个文件,但不适用于网站的其他部分。

例如,我希望public_html/directory/downloads内的所有文件都有等待时间,但我不希望这会影响public_html/directorypublic_html/中的其他文件。

1 个答案:

答案 0 :(得分:0)

我会用三个文件和下载文件来完成。将下一个代码复制并粘贴到三个文件(Z.HTML,ZZ.HTML和ZZZ.HTML)中,您将需要下载文件(ZZZZ.CMAP)。

Z.HTML:

<html>
  <head>
    <title>Redirect</title>
  </head>
  <body style="background-color:cyan;">
    <a href="zz.html">Click here to download file</a>
  </body>
</html>

ZZ.HTML:

<meta http-equiv="refresh" content="5;URL=zzz.html" />
<html>
  <head>
    <title>Waiting</title>
  </head>
  <body style="background-color:pink;">
    Wait 5 seconds before download the file (in the meantime, enjoy our publicity)
  </body>
</html>

ZZZ.HTML:

<html>
  <head>
    <title>Downloading</title>
    <script type="text/javascript">
setTimeout( "window.location='zzzz.cmap'",1000 );
    </script>
  </head>
  <body style="background-color:yellow;">
    Downloading
  </body>
</html>

获得这三个文件后,双击Z.HTML开始此过程。

相关问题