title: Run JQuery first and then download files when link clicked
body: <p>I have a link which has direct file download URL in it. So when a user click on the link, that file downloads.</p>
  
  <p>Here is the link:</p>
  
  <pre><code>&lt;a class="download-video" href="http://mylink.mp4?file=1&amp;name=A Video"&gt; Download&lt;/a&gt;
  </code></pre>
  
  <p>I was hoping to run some JQuery before this file downloads. I was able to work a solution, but instead of direct downloading, I am redirected to the video. All I want is to download withouth any redirection. This is what I tried:</p>
  
  <pre><code>$('a.download-video').click(function(event) {
  
      var href = this.href;
      //My JS Code
      alert(href);
  
      event.preventDefault();
  
     window.location = href;
  });
  </code></pre>
  
  <p>Thanks</p>