Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations bkrike on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Click link to download

Status
Not open for further replies.

HumbleSeeker

Programmer
Nov 29, 2002
37
GB
I'm pretty sure this isn't possible, but the programming Gurus of this forum have surprised me before.

Is there anyway to have a link to a file and when the user clicks on it it brings up the save as screen rather then opening the file. The file in question is a pdf, so I can't count on it being downloaded.

Thanks for reading this, and thanks if you can help.
 
I've managed to do sort of what I want
Basically what I've done now is produce two functions:

function downLoadNow()
{
if (document.execCommand)
{

parent.pdfFrame.document.execCommand("SaveAs")
}
}

function prepareDownload()
{
parent.pdfFrame.location.href = "download/testFile.pdf"
}

I'm using an invisble frame to hold the PDF. I load my main page, which has prepareDownload in it's onload. I then call downLoadNow through a link using the onClick command.

Now the problem is I can't open the downloaded file. I know its a minor inconvience, but its one I'd like to fix. Anyone know how to get the file readable?

Thanks.


__________________
Humble Seeker

The longest journey starts with the smallest step, and knowledge is the longest journey of all.

 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top