Wrox Programmer Forums
|
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
 
Old June 23rd, 2004, 10:50 AM
Friend of Wrox
 
Join Date: Jun 2003
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';
    }
}
//--></script>

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

Many Thanks
Mike
__________________
Peace
Mike
http://www.eclecticpixel.com
 
Old June 23rd, 2004, 12:20 PM
Friend of Wrox
 
Join Date: Nov 2003
Posts: 1,285
Thanks: 0
Thanked 2 Times in 2 Posts
Default

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.

HTH,

Snib

<><
 
Old June 23rd, 2004, 02:03 PM
Friend of Wrox
 
Join Date: Jun 2003
Posts: 249
Thanks: 0
Thanked 0 Times in 0 Posts
Default

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.





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





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