jeger003 Posted June 30, 2010 Share Posted June 30, 2010 hello, is there a way to pause a few seconds before running a script. what im doing is, when a visitor clicks a download button. I want it to pause like 5 seconds and show a little logo before running the script to download the file. any ideas with this? Thanks Guys! Quote Link to comment https://forums.phpfreaks.com/topic/206241-is-there-way-to-delay-a-script-from-running/ Share on other sites More sharing options...
Psycho Posted June 30, 2010 Share Posted June 30, 2010 The link should take the user to another page where the logo is displayed. That page could also use a meta refresh tag to start the download after 5 seconds Quote Link to comment https://forums.phpfreaks.com/topic/206241-is-there-way-to-delay-a-script-from-running/#findComment-1078975 Share on other sites More sharing options...
jeger003 Posted June 30, 2010 Author Share Posted June 30, 2010 could you possibly give a short example on how i can run the download after 5 seconds? Quote Link to comment https://forums.phpfreaks.com/topic/206241-is-there-way-to-delay-a-script-from-running/#findComment-1078981 Share on other sites More sharing options...
gizmola Posted June 30, 2010 Share Posted June 30, 2010 Take a look into the javascript setTimeout() function. Quote Link to comment https://forums.phpfreaks.com/topic/206241-is-there-way-to-delay-a-script-from-running/#findComment-1078983 Share on other sites More sharing options...
Psycho Posted June 30, 2010 Share Posted June 30, 2010 With all due respect, JavaScript is not required <html> <head> <meta http-equiv="refresh" content="5;url=http://yoursite.com/file.pdf"> </head> <body> Your file will download in 5 seconds. If it does not start automatically, click <a href="http://yoursite.com/file.pdf">here</a>. </body> </html> Quote Link to comment https://forums.phpfreaks.com/topic/206241-is-there-way-to-delay-a-script-from-running/#findComment-1079051 Share on other sites More sharing options...
jeger003 Posted June 30, 2010 Author Share Posted June 30, 2010 thank you very much Quote Link to comment https://forums.phpfreaks.com/topic/206241-is-there-way-to-delay-a-script-from-running/#findComment-1079085 Share on other sites More sharing options...
gizmola Posted July 1, 2010 Share Posted July 1, 2010 With all due respect, JavaScript is not required Your file will download in 5 seconds. If it does not start automatically, click here. No worries if that solves his problem, but it wasn't what he asked for. He asked to click a button -- display a message and then do the download, so I discounted the meta refresh. Quote Link to comment https://forums.phpfreaks.com/topic/206241-is-there-way-to-delay-a-script-from-running/#findComment-1079498 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.