Delay Download Popup

guys please help me with the following trble.

i have a download link in one of my page. when i click it i want it to redirect to another page and after 10 secs i want a download to begin.

any idea how i can implement that

Create a link(Controller action)first. Which will show some message like your download will begin in 10 second. Basically this is middle layer.

Create another link which will create a download file.

So, on link firt page view you have to write some js code like,

function beginDownload(){


  var DOWNLOADLINK= <?php echo Yii::createAbsoluteUrl("your link");?> 



call this beginDownload() on body load of this page like

window.onload = beginDownload();

and you are done. Well i am not sure i have write a correct code here in terms of syntax.But the logic is 100% correct.