Content-Disposition:attachment not triggering download dialog

后端 未结 3 967
猫巷女王i
猫巷女王i 2020-12-29 06:36

I\'ve encountered some unexpected behavior when trying to create a file download functionality on my NodeJS server. I have a REST (express) API that calls for some export da

3条回答
  •  星月不相逢
    2020-12-29 07:14

    You can try to use a different content-type, so that won't be open as a text file on the browser:

    Content-Type:application/ms-excel; charset=UTF-8
    

    Another alternative could be to use application/octet-stream as mime-type to define it as a downloadable file without a better description.

    Content-Type:application/octet-stream; charset=UTF-8
    

提交回复
热议问题