hi,
How to dowload a file using javascript.
You can't download a file as such using JavaScript. Why would you want to do that anyway? If you must have a page which provides an automatic download, you need to use a server side language, e.g. ASP, ColdFusion, JSP, etc.
e.g. in ASP:
-
Response.ContentType = "application/vnd.ms-word"
-
Response.AddHeader "content-disposition","attachment; filename=" &
-
StrFileName
or something similar (ASP's not my area of expertise) or in Coldfusion you can use the cfcontent tag. In other words, JavaScript is a client side language - you need to use a server side language for this purpose.