Wrox Programmer Forums

Need to download code?

View our list of code downloads.

Go Back   Wrox Programmer Forums > Web Programming > JavaScript > Javascript How-To
Password Reminder
| FAQ | Members List | Search | Today's Posts | Mark Forums Read
Javascript How-To Ask your "How do I do this with Javascript?" questions here.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the Javascript How-To section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
DRM-free e-books 300x50
Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old June 23rd, 2004, 10:50 AM
Friend of Wrox
Join Date: Jun 2003
Location: Oklahoma City, Oklahoma, USA.
Posts: 249
Thanks: 0
Thanked 0 Times in 0 Posts
Default Force A File To download

Does somebody know how to force a file to download with Javascript. I googled around and found this code but it does not work.

<script language="JavaScript"><!--
function gogetit() {
    if (document.images) {
        var myImage = new Images();
        myImage.src = 'images/BratFestGroupApp_060104.pdf';

<form><input type="button" value="Click Here" onClick="gogetit()"></form>

Many Thanks
Reply With Quote
  #2 (permalink)  
Old June 23rd, 2004, 12:20 PM
Friend of Wrox
Join Date: Nov 2003
Location: , , .
Posts: 1,285
Thanks: 0
Thanked 2 Times in 2 Posts

I don't think you can force a download with JS. Usually people use a server language such as PHP or ASP or CF to accomplish this.



Reply With Quote
  #3 (permalink)  
Old June 23rd, 2004, 02:03 PM
Friend of Wrox
Join Date: Jun 2003
Location: Oklahoma City, Oklahoma, USA.
Posts: 249
Thanks: 0
Thanked 0 Times in 0 Posts

There within lies my problem, it's for a client who has some kind of newsletter system set up through somebody, it's running cold fusion, I am not familiar with. I am having to input the html via form. So I was hoping I could find something simple with javascript.
Reply With Quote

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are Off
Pingbacks are On
Refbacks are Off

Similar Threads
Thread Thread Starter Forum Replies Last Post
Smaller download/single download file available jminatel BOOK: Beginning ASP.NET 2.0 BOOK VB ISBN: 978-0-7645-8850-1; C# ISBN: 978-0-470-04258-8 0 November 21st, 2005 11:10 AM
force download dialog alphyne HTML Code Clinic 1 October 25th, 2005 08:02 AM
Force a word download into a frame? interrupt Javascript How-To 1 August 15th, 2004 10:54 AM
Force A File To Download harpua Classic ASP Basics 6 July 26th, 2004 01:06 PM
code to force xls file to open after several hours helmekki Excel VBA 1 June 16th, 2004 02:42 AM

All times are GMT -4. The time now is 06:15 AM.

Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
© 2013 John Wiley & Sons, Inc.