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 gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

download word document 1

Status
Not open for further replies.

terrydoughty

Technical User
Aug 31, 2000
145
GB
I want to allow visitors to my web site to download (not open) a word document. How is this achieved?

Many thanks
 
This usually depends on how the user has his / her browser settings. You can ZIP the document to help to ensure downloading.

Having said that, there is this way in javascript (you might be better off posting in the JS category for more help)
Code:
(1) In your HTML file, add the following Javascript:

  function callSaveAs() {
    if (document.execCommand) {
      document.execCommand("SaveAs");
        location = 'listGenerateRecurrentPayment2.html';
      }
    } else {
      alert('SaveAs Function Not Supported by Browser');
    }
  }

(2) In the desired location (a Form Button, a HREF link, etc.), add this Javascript action to it:

  onclick='javascript:callSaveAs();
And you can review:
__________________________
Corey

 
Thanks for the response BUT how do I add the Javascript?

I tried copying and pasting as you wrote it in the head of the HTML and on previewing the text moves to the body.
Excuse my ignorance.
 
You would need to copy it to notepad to strip out the coding that the word page adds to it. But you are better off ZIPping the file. It will be much easier on everyone because what you are trying to do is overwrite the user's settings.

__________________________
Corey

 
How do I zip the file?
Excuse my ignorance.

Many thanks,

terry
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top