json xhr response opens a download file popup window

前端 未结 5 1703
孤街浪徒
孤街浪徒 2021-02-04 08:09

For one of our ajax request (with a .json response) some of our clients have complained that they are seeing a \"File Download\" prompt asking the user to download the .json res

5条回答
  •  傲寒
    傲寒 (楼主)
    2021-02-04 08:31

    Drop the .json and set the content type as text/html. IE doesn't know what type of file you are sending it, so it offers to download. It knows what to do with text/html :)

提交回复
热议问题