title: CSV Downloaded To Chrome - Error: MIME Type text/csv
body: <p>I am using jQuery to recognise a click on a button which then fires a call to a file:</p>
  
  <pre><code>window.location.href = "url";
  </code></pre>
  
  <p>This file queries the database, returns results then writes it to a CSV file. I have the following headers set:</p>
  
  <pre><code>header('Content-Type: text/csv;');
  header('Content-Disposition: attachment; filename=data.csv');
  </code></pre>
  
  <p>This works on all browsers except Chrome which returns the following error in the console log "Resource interpreted as Document but transferred with MIME type text/csv: "url"".</p>
  
  <p>The weird thing is that if I call the file directly it works in all browsers.</p>
  
  <p>Code:</p>
  
  <pre><code>                $fp = fopen('php://output', 'w');
  
                  header('Content-Type: text/csv;');
                  header('Content-Disposition: attachment; filename=data.csv');
                  header("Expires: 0");
                  header("Cache-control: private");
  
                  //Field Headers
                  $ncols = oci_num_fields($stid);
                  $headers_row = array();
                  for ($i = 1; $i &lt;= $ncols; ++$i) {
  
                      $headers_row[] = oci_field_name($stid, $i); 
  
                  }
  
                  while ($row = oci_fetch_array($stid, OCI_NUM+OCI_RETURN_NULLS)) {
  
                      if(!empty($row)){
                          if(!empty($headers_row)){
                              fputcsv($fp, $headers_row);
                              $headers_row = '';
                          }
  
                          fputcsv($fp, $row);
                      }
  
                  }
  
                  fclose($fp);                    
                  oci_close($conn);
  </code></pre>
  
  <p>Anyone got any ideas?</p>