J
Jonathan Wood
Greetings,
I'm creating a shareware site and I want the download page to initiate
downloading a file when it loads.
After thinking about this, it seemed like javascript was the best way to do
this. So I tried creating a startup script that used window.open(), but this
causes most browsers to report a pop-up was attempted. So I changed it to
window.location.href. This works but, on some browsers, the page doesn't
finish loading. So I changed it to
setTimeout("window.location.href='url'",1500), which waits a moment before
performing the download.
This last approach appears to work. I also include a download link in case
javascript is not enabled. But I'm feeling a bit unsure of myself.
Does this seem like the best approach? I'm a little concerned impatient
users might click the link when it doesn't start downloading immediately.
Also, I'm not clear on when the browser decides to continue showing the
current page after setting window.location.href (as it generally appears to
do when I set the URL to a downloadable file).
Any tips appreciated.
Jonathan
I'm creating a shareware site and I want the download page to initiate
downloading a file when it loads.
After thinking about this, it seemed like javascript was the best way to do
this. So I tried creating a startup script that used window.open(), but this
causes most browsers to report a pop-up was attempted. So I changed it to
window.location.href. This works but, on some browsers, the page doesn't
finish loading. So I changed it to
setTimeout("window.location.href='url'",1500), which waits a moment before
performing the download.
This last approach appears to work. I also include a download link in case
javascript is not enabled. But I'm feeling a bit unsure of myself.
Does this seem like the best approach? I'm a little concerned impatient
users might click the link when it doesn't start downloading immediately.
Also, I'm not clear on when the browser decides to continue showing the
current page after setting window.location.href (as it generally appears to
do when I set the URL to a downloadable file).
Any tips appreciated.
Jonathan