content-type of text-plain causes browser to download of file

后端 未结 2 855
野性不改
野性不改 2021-02-19 08:25

I\'m writing a web application API, where when someone accesses a URL, it returns text data. I set the content-type to \"text/plain\", but when I access it with Chrome, it down

2条回答
  •  庸人自扰
    2021-02-19 08:45

    Laurence's explanation is correct. Only IE and Chrome is performing mime sniffing at the time of this post. You can now just set the HTTP header X-Content-Type-Options: nosniff and it will do the trick!

提交回复
热议问题