SitePoint Sponsor

User Tag List

Results 1 to 2 of 2
  1. #1
    SitePoint Enthusiast
    Join Date
    May 2007
    0 Post(s)
    0 Thread(s)

    Unhappy download image file when button clicked

    halo there...need some help..
    a href=""><img src="img/download_file.gif" alt="Download Image" border="0" /></a>
    i have a button link code. iwan to do when i click on the button, a window ask me download the file will popup and then i click on Open,Save OR Cancel to get the image file into my pc. how can i do this in JS? plz help..urgent.thank you

  2. #2
    Follow Me On Twitter: @djg gold trophysilver trophybronze trophy Dan Grossman's Avatar
    Join Date
    Aug 2000
    Philadephia, PA
    1 Post(s)
    0 Thread(s)
    In order to *force* a download dialog rather than whatever the user's browser is configured to do with that image type, you'll need to either modify the web server configuration or write a server-side program. You'd need to change the content-type header that's sent before the file to something like force-download or octet-stream so that the browser doesn't handle it as an image.

    You can't change the behavior of linking to an image with JavaScript alone.


Posting Permissions

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