导致javascript或javascript自动执行[关闭]

Hi I have a script which allows for downloads when the page is visited and link is clicked. I want to edit things so that once the link is clicked the download will start as specified the javascripts but it will then start download and direct to a thank you page. Here is an examaple:

  1. Website visitor click the Download Link the Download Starts
  2. Then website visitor is automatically redirected to a thank you page

The sample of the page and Javascript coding can be found here by inspecting the source code of the page http://www.mynetdownload.com/testdwld.html

Once a download is starting, the 'current' page is the file that is downloading, so you will no longer have 'control' over the browser.

You should therefore reverse that;

  1. Website visitor click the Download Link
  2. Visitor goes to a 'thank you' page; Thank you for downloading this file. Your download should start automatically. If the download does not start automatically, click the link below: [download link]
  3. The visitor is redirected to the file download

Because the 'download' is not shown inside the browser, the thank you page will remain visible during the download process.

Redirecting to the file-download can be done via a regular HTML redirect header in your <head>:

E.g. To have the download (redirect) start after 10 seconds:

<meta http-equiv="refresh" content="10; url=http://example.com/downloads/file1.zip">