Web Development

General discussion


download Word document with JavaScript

By zabronm ·
I want to enable my clients to download a word application form from my website. I want to use JavaScript or simple html (not cgi). Is this possiblea nd if it is, how? I want the download dialog box to appear so that users chose to open or save it locally. Please help

This conversation is currently closed to new comments.

Thread display: Collapse - | Expand +

All Comments

Collapse -


by Jay Eckles In reply to download Word document wi ...

You're going to have to do something on the server side if you want to attempt to make a download dialog box appear. One thing you could do is configure your webserver so that the mime type of any document ending in .doc is application/octet-stream. If you use a CGI program to fetch the word docs, you can set the content-type dynamically and you can suggest a name for the file being downloaded.

My suggestion is that you just provide hyperlinks to the Word documents on your server. If people want to save it, they can either click the link then use the Word menus or, if they're using Windows and IE, they can right click on the link and save the target. Almost all browsers on all platforms have some provision for saving the target of alink.

Trust the users. They know how to use their software.

Good luck.


Collapse -

add it in your code

by monakardoost In reply to download Word document wi ...

Copy the following code into your HEAD tags:

<script language="JavaScript">
No rightclick script v.2.5
(c) 1998 barts1000
Don't delete this header!

var message="Sorry, that function is disabled.\nThis Page Copyrighted and\nImages and Text protected!\nALL RIGHTS RESERVED";

// Don't edit below!

function click(e) {
if (document.all) {
if (event.button == 2) {
return false;
if (document.layers) {
if (e.which == 3) {
return false;
if (document.layers) {
// -->


Related Discussions

Related Forums