|
|
|||||||||
|
|||||||||
|
|||||||||
| |
|||
| |||||||||
![]() |
|
|
«
Previous Thread
|
Next Thread
»
|
Thread Tools | Search this Thread | Display Modes |
|
#1
|
|||
|
|||
|
Script » Download file via hyperlink
Hello!
I'm putting together a page that'll include a link to a freebie .tif file (stored on the server) that my site visitor can download upon completing a brief questionnaire. Other than «right-clicking», is there a script that will automatically launch a «Save file» dialog box so that they can download the file? js? php? Thanks, Robsta ![]()
__________________
http://www.fond-regards.com |
|
#2
|
||||
|
||||
|
From what I understand of your question, there's two common options. Either a specific file download page, or javascript.
You could always create one of those traditional download pages, something like what Download.com uses... the download starts automatically when the page loads, as well as a link that reads "If the download doesn't start, click here"... Download.com actually uses an <IFRAME> to popup the dialog... <iframe height="0" width="0" src="http://localhost/some.file"></iframe> You could also do a javascript onload (or even onclick) function, but not all users have javascript enabled... <body onload="javascript:window.location.href='http://localhost/some.file';"> [*edit* for some reason it looks like i'm getting a space in the word javascript from my example above... make sure you don't print that] One problem you may encounter is that if a user's browser is setup to display the TIFF mime type (image/tiff) then the user will see the actual image, as opposed to seeing the download prompt. |
|
#3
|
|||
|
|||
|
Thanks for the code!! I'll probably go the js route. Also, thanks for the *edit* on javascript (all one word). I knew that, but I probably would have copied/pasted as is...
Robsta ![]() |
|
#4
|
||||
|
||||
|
heh, its strange...
when I edited the the post, it displays as javascript (all one word), but when its read through the forum there's a space... and when i copied it from theforum there's a space... maybe i'm just blind... =) I'm pretty sure that the javascript code i provided is cross-browser, but I haven't tried it... also remember, some users may have not javascript enabled, so an additional/alternate method is a good idea |
|
#5
|
|||
|
|||
|
Hi!
It's probably because I started the thread on a Mac ![]() Yes, I'll post some «Right-click» info so they can download the file that way if need be. I've not had a chance to implement it yet - I'll let you know how it turns out. Thanks again, Robsta ![]() |
|
#6
|
|||
|
|||
|
Ok here we go I used the same code here in Frontpage 2003 and it works perfectly. I was wondering if I could use the same code and have it linked some how to the gif images I have already created like how do I link your code with my gif. I also wanted to have it so you have to manually click the icon(gif). I had a page where all 200 files popped up at one time...not cute lol. I am very green in this field I usually fix workstations and some server 2003 issues. Web design is a new hobby...lol but I am loving it.
Quote:
|
![]() |
| Viewing: Dev Articles Community Forums > Web Design > Web Development > Script » Download file via hyperlink |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|
|
|