Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Resource interpreted as Document but transferred with MIME type text/csv:

Tags:

html

jquery

csv

I generate a csv file in the server side and make it available in the client side. I get this message in Google Chromes Developer Tools Console when I attempt to download a csv file : Resource interpreted as Document but transferred with MIME type text/csv and an pop up that says "error"

This is the tag I'm using to let the client download the file

    <a type="text/csv" href="download.csv">download</a>

How do I transfer the file without receiving that message in the console?

like image 843
sportsfan72 Avatar asked Mar 22 '23 18:03

sportsfan72


2 Answers

Making your anchor tag target another page should cause the warning to show up on the new page rather than the current page, but since the new page will be immediately closed, it won't be noticeable.

target="_blank"
like image 175
Kevin B Avatar answered Apr 06 '23 05:04

Kevin B


You could try using the download attribute, but it it has limited browser support right now.

You could probably combine this with a target="_blank" with no ill effects.

like image 32
Snekse Avatar answered Apr 06 '23 06:04

Snekse