Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7502311
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 29, 20262026-05-29T20:49:23+00:00 2026-05-29T20:49:23+00:00

SOLVED: View the answer below marked SOLVED. Thanks. I am trying to download a

  • 0

SOLVED: View the answer below marked SOLVED. Thanks.


I am trying to download a file from location specified by url on click. I am using a delegate but when the button clicks the browser navigates to the location of the file and displays the contents. I want the click to trigger the browser’s download dialog.

Here is the code:

$('#left').delegate("a", "click", function(event){
    //alert("CLICKED");

    event.preventDefault();
    window.location.href = url;

});

All posts regarding this question says to use the “event.preventDefault();” but that does not work for me. Does anyone have any suggestions?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-29T20:49:25+00:00Added an answer on May 29, 2026 at 8:49 pm

    You may need to change the server side (if you are able to).

    The http response must contain the header:

    Content-disposition: attachment; filename=fname.ext

    So the browser knows that it must open the download dialog. Otherwise the browser will try to open/preview it.

    More info:

    Microsoft Support

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Update: Solved, with code I got it working, see my answer below for the
Solved: see answer below I am sub-classing Dialog to create a dialog with a
SOLVED in the last answer im getting following error, dunno where and why? cause
SOLVED I misspelled the property department -> Department. Thanks for the answers and a
I have recently started using doc-view in Emacs, but I am having quite a
Here's a simple python function that checks if a given url is valid: from
Following on from this question , I'm using a simple ViewModel class to test
I have a Django view, which receives part of its data from an external
In the file $MAGENTO_PATHapp/design/frontend/base/default/template/catalog/product/view/options/wrapper.phtml , I see the following line of code: <?php echo
I am using ASP.NET MVC 2 & 3 with aspx View not Razor View,

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.