Using Javascript to add custom http header and trigger file download

后端 未结 3 1840
你的背包
你的背包 2021-01-11 14:19

I would like to start a simple file download through the browser, however an access token must be passed with a custom HTTP header:

GET https://my.site.com/s         


        
3条回答
  •  星月不相逢
    2021-01-11 15:20

    It is not possible to add custom http header when you download a file by clicking on a link.

    However, in your use case, you might store the token in a cookie, which will be automatically added to all browser requests.

提交回复
热议问题