0

In my WordPress website I have a file to download. When user click the button the download start.

But what I want is when a user click on button it opens a new page, show a countdown of 5 seconds and message "your download will start automatically if not click here." Can anyone help me with this matter. I have searched a lot on Internet for any plugin or solution but found nothing. Thanks

Magnus Karlsson
  • 3,549
  • 3
  • 31
  • 57
Zeeshan
  • 43
  • 1
  • 13

2 Answers2

1

Put that JavaScript

var downloadButton = document.getElementById("download");
var counter = 10;
var newElement = document.createElement("p");
newElement.innerHTML = "You can download the file in 10 seconds.";
var id;
downloadButton.parentNode.replaceChild(newElement, downloadButton);
id = setInterval(function() {
counter--;
if(counter < 0) {
    newElement.parentNode.replaceChild(downloadButton, newElement);
    clearInterval(id);
} else {
    newElement.innerHTML = "You can download the file in " + counter.toString() + " seconds.";
}}, 1000);
0

You can also try with an iframe in the article body. Make sure you choose to edit it as Text and not Visual.

<iframe src="[your archive url]" width="1" height="1" frameborder="0"></iframe>

<p style="text-align: center; margin-bottom: 0;">YOUR SOFTWARE IS NOW DOWNLOADING.</p>
<p style="text-align: center;"><em>If the download doesn't start automatically, 
<a href="[your archive url]" target="_blank">click here</a> </em></p>

It's simpler this way.

Find more about it here: How to start automatic download of a file in Internet Explorer?

Community
  • 1
  • 1