Download link question

Discussion in 'Mac Help/Tips' started by shakespeare, Feb 21, 2003.

  1. shakespeare macrumors 6502

    Joined:
    Apr 29, 2002
    Location:
    Portland, Maine
    #1
    In HTML, how do you write a link to a file so that the browser will download the file to disk, rather than try to open it itself?
     
  2. yzedf macrumors 65816

    yzedf

    Joined:
    Nov 1, 2002
    Location:
    Connecticut
    #2
    that is a browser setting.

    that is why there is right-click or ctrl-click...
     
  3. rainman::|:| macrumors 603

    rainman::|:|

    Joined:
    Feb 2, 2002
    Location:
    iowa
    #3
    it's not how you link a file, it's how the browser on the other end is set to handle it. For instance, Safari knows that files ending in ".dmg" aren't viewable in a Safari window, so it downloads it instead. Most browsers have a control panel that lets you change settings for various file extensions and MIME types.

    pnw
     
  4. shakespeare thread starter macrumors 6502

    Joined:
    Apr 29, 2002
    Location:
    Portland, Maine
    #4
    Yes, I realize that, but I'm thinking here of a special page for downloads, such as the "file sharing" pages on .Mac where you can access members' iDisk public folders. On those pages you can just click a little "download" arrow and the file starts downloading right away.

    I'd love to have people on my website just click an icon and have the file download automatically - and I'd rather not have to teach them how to configure their browsers or right-click &c. Is there any way?
     
  5. ibookin' macrumors 65816

    ibookin'

    Joined:
    Jul 7, 2002
    Location:
    Los Angeles, CA
    #5
    Not sure if there is a way to do that in HTML, but I think you can configure your webserver (Apache in Mac OS X, etc.) to not recognize file types, which would make the browser download the file by default. I'm not sure if this would work, though...

    You need to have access to your webserver config to do this.
     
  6. shakespeare thread starter macrumors 6502

    Joined:
    Apr 29, 2002
    Location:
    Portland, Maine
    #6
    Thanks for the help - does anyone have any idea how the File Sharing pages on .Mac pull this off?
     
  7. yzedf macrumors 65816

    yzedf

    Joined:
    Nov 1, 2002
    Location:
    Connecticut
    #7
    read the page source...? if it isn't obvious then it must be serverside.
     
  8. shakespeare thread starter macrumors 6502

    Joined:
    Apr 29, 2002
    Location:
    Portland, Maine
    #8
    Mm, I did read the page source - on a Mac, the page links to a .sit file, which automatically downloads (rather than opens in the browser); and on Windows, it links to a mysteriously named file 'shakespeare.pdf-link.pdf' or 'shakespeare.html-link.html' &c. The part before the hyphen is the real filename, and what follows, just a 'link'.

    So yes, I suppose, that must be serverside. Damn, I guess I'll have to wait a while before I figure it out.
     

Share This Page