Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 7 of 7
  1. #1
    New to the CF scene
    Join Date
    Sep 2011
    Posts
    2
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Can you download files with AJAX?

    I'm new to website design, one of those autodidact types (self-teachers.) The client-side programming is coming to me, I haven't yet tried to tackle server-side. I need to develop webpage with download functionality for video and audio files, and would like it to be more user friendly and professional looking than the HTML double-click and hit Save method. Is there an AJAX solution for this, or do I need to look elsewhere?

  • #2
    Regular Coder
    Join Date
    Apr 2005
    Location
    Texas
    Posts
    448
    Thanks
    24
    Thanked 63 Times in 63 Posts
    Are you looking to get around the "hit Save method"? because I wonder, how would they know where to download the file to? My understanding is that an <a href=> that points to certain file types (zip,exe,hta) will automatically prompt for downloading in a user-friendly fashion. When you say "download", could you mean "stream", or do you want to save to disk for offline viewing? And how would you like that to look to the end user if not "HTML double-click and hit Save method"

  • #3
    New Coder
    Join Date
    Mar 2010
    Posts
    30
    Thanks
    0
    Thanked 1 Time in 1 Post
    If you want to stream these audio/video files, you have three options:

    1. HTML5 <video> and <audio> tags, note you will have to have multiple sources of different a/v formats in order for all (modern) browsers to be able to play them.

    2. Use a Flash video player to load the files on your page.

    3. Upload the videos to YouTube and then embed them in your page. Note that this means you won't have to pay for video bandwidth!

  • #4
    New to the CF scene
    Join Date
    Sep 2011
    Posts
    2
    Thanks
    0
    Thanked 0 Times in 0 Posts
    I want the user to be able to single-click a button, like they are used to doing to download a file onto their harddrive, not the double-click method of the basic HTML approach. I have no problem with whatever dialog boxes the OS throws up asking users what they want to do with the file. By "download' I mean the ability to save the audio or video file to harddrive, I have no intention of trying to stream clips. The <a href=> news sounds good (except for the potential double-click that might throw off users) but it would need to apply to the kind of file format we will offer. Off the top of my head, I do not know what format we record in, but I can find that out pretty quickly. If you could even point me to a promising info source about what the basic <a> tag offers in functionality, I would be very appreciative. I would be more appreciative if I could offer the users the convenience of a single-click, which my previous research led me to understand had to be done programmatically.
    Last edited by satwood; 09-30-2011 at 04:42 PM. Reason: left out answer regarding "hit and Save"

  • #5
    Regular Coder
    Join Date
    Apr 2005
    Location
    Texas
    Posts
    448
    Thanks
    24
    Thanked 63 Times in 63 Posts
    <a> tag:
    http://www.w3schools.com/tags/tag_a.asp

    But I honestly don't know what you mean by
    the double-click method of the basic HTML approach
    HTML is automatically single click...
    The only way I know how to override the nature of an HTML element to force the user to double click is ondblclick=""
    I wish I could help out more with that single/double click thing, but I'm not sure I'm thinking of the same thing you are... I hope that link helps

    Edit:
    Maybe if you showed an example of the code that requires a double click
    Last edited by blaze4218; 09-30-2011 at 07:43 PM.

  • #6
    New to the CF scene
    Join Date
    Oct 2011
    Posts
    1
    Thanks
    0
    Thanked 0 Times in 0 Posts
    Travel beautiful Bangladesh
    Quote Originally Posted by blaze4218 View Post
    <a> tag:
    http://www.w3schools.com/tags/tag_a.asp

    But I honestly don't know what you mean by

    HTML is automatically single click...
    The only way I know how to override the nature of an HTML element to force the user to double click is ondblclick=""
    I wish I could help out more with that single/double click thing, but I'm not sure I'm thinking of the same thing you are... I hope that link helps

    Edit:
    Maybe if you showed an example of the code that requires a double click

  • #7
    Senior Coder rnd me's Avatar
    Join Date
    Jun 2007
    Location
    Urbana
    Posts
    4,293
    Thanks
    10
    Thanked 583 Times in 564 Posts
    i've never heard of double-clicking anything on the web, save a few games here and there...

    if you want a media file to trigger a download instead of being handled by the browsers/plugins, you need to add a header the the file using a server application of some sort. it's kinda a pita to tack on a single header to a file; you have to load and print the file instead of just serving the file with apache. you might be able to use an apache rewrite rule to automatically add the content-disposition: attachment header, never tried...
    Last edited by rnd me; 10-02-2011 at 07:17 PM.
    my site (updated 13/9/26)
    BROWSER STATS [% share] (2014/5/28) IE7:0.1, IE8:5.3, IE11:8.4, IE9:3.2, IE10:3.2, FF:18.2, CH:46, SF:7.9, NON-MOUSE:32%


  •  

    Posting Permissions

    • You may not post new threads
    • You may not post replies
    • You may not post attachments
    • You may not edit your posts
    •