View Full Version : Pop up screen when the user clicks to download

12-02-2009, 11:46 PM
Hello I want to add something to my web site. when the user clicks to download. i want to see a pop up screen which says your download has started.

<script type="text/javascript">
function show_alert()
alert("Your Download Started!");

<input type="button" onclick="show_alert()" onclick="get value="Download" />

I dont get where should i put the download link

Old Pedant
12-03-2009, 01:28 AM
Something like this, maybe?

<a href="/path/to/downloadfile.pdf" onclick="alert('Your download should start now'); return true;">
Download all the good stuff

Old Pedant
12-03-2009, 01:29 AM
Ahhh...but wait! The user would have to click on the OK button of the alert before the download would start. Is that what you want? Or you want both to happen at same time?

12-04-2009, 02:40 AM
no, he clicks and it ust warns that download started this logic should work let me see thank you=)

12-04-2009, 02:44 AM
There is no download link in here :/?

12-04-2009, 02:56 AM
My dear friend I made the code like this
<a href="files.me.com/ongun/b4sll8" onclick="show_alert();"><input name="Download" type="button" value="Download" /></a>

It does not download anything

12-04-2009, 04:02 AM
Because your code is wrong. You cannot put a button inside a link and expect the button to work as a link.

If you want it as a button:

<input type="button" value="Download" onclick="show_alert(); location.href='files.me.com/ongun/b4sll8';" />

If you want it as a link:

<a href="files.me.com/ongun/b4sll8" onclick="show_alert();">Download</a>

12-04-2009, 06:05 PM
Thank you very much Glenn, but there is no download started here

12-04-2009, 09:57 PM
You mean the "Your Download Started!" alert did not appear or the browser's download dialog did not appear?