title: window.href.location not working in chrome
body: <p>Please read the question before flagging as duplicate. I'm trying to download a file by redirecting with Javascript to a controller action in my ASP.NET MVC3 project. It works perfectly in Firefox and IE8. Here's my Javascript code:</p>
  
  <pre><code>&lt;script type="text/javascript"&gt;
      $(function(){
          $(".pdf").click(function(e) {
              e.preventDefault();
              $.post("@Url.Action("PDF","Helper")", {id : @Model.ID} ,function(data){
                  if(data.message == "File not found.") {
                      alert(data.message);
                  } else {
                      location.href = '@Url.Action("PDF", "Helper", new { id = Model.ID })';
                  }
              });
          });
      });
  &lt;/script&gt;
  </code></pre>
  
  <p>Here's what I tried:</p>
  
  <ol>
  <li><p>I added <code>return false;</code> with all the things below</p></li>
  <li><p>I changed the line to:</p>
  
  <pre><code>window.location.href = "../../Helper/PDF/@Model.ID";
  </code></pre></li>
  <li><p>I tried <code>window.location</code> instead</p></li>
  <li><p>I changed relative link to full link</p></li>
  <li><p>Tried without <code>window</code></p></li>
  <li><p>Tried:</p>
  
  <pre><code>setTimeout(function() {
      document.location.href = '@Url.Action("PDF", "Helper", new { id = Model.ID })'
  },500);
  </code></pre></li>
  <li><p>I added the line:</p>
  
  <pre><code>window.event.returnValue = false;
  </code></pre>
  
  <p>it gave the error "window.event is not defined". I replaced it with <code>e</code>.</p></li>
  <li><p>I wrote "<a href="http://www.google.com" rel="nofollow noreferrer">http://www.google.com</a>" instead, and it didn't work too. However, it worked in a separate html file only consists of <code>location.href = "http://www.google.com";</code>.</p></li>
  </ol>
  
  <p>All of this worked in IE8 and Firefox but not in Chrome. What can I do to resolve this?</p>
  
  <p><strong>EDIT</strong>:
  This is generated script:</p>
  
  <pre><code>$(function(){
      $(".pdf").click(function(e) {
          e.preventDefault();
          $.post("/Helper/PDF", {id : 130405002} ,function(data){
              if(data.message == "File not found.") {
                  alert(data.message);
              } else {
                  location.href = '/Helper/PDF/130405002';
              }
          });
      });
  });
  </code></pre>
  
  <p>This is the generated HTML where I call the function: </p>
  
  <pre><code>&lt;input class="pdf" type="button" value="Download File" /&gt;
  </code></pre>
  
  <p>Debugging the action I got these results; at the console Status is "failed". <code>Type</code> is "application/pdf" as expected and <code>Size</code> is 198 kb, it's the file size. Method is <code>POST</code>.</p>
  
  <p>This is my console output:</p>
  
  <blockquote>
    <p><img src="https://i.stack.imgur.com/1dxve.jpg" alt="console output"></p>
  </blockquote>