Using Javascript to add custom http header and trigger file download

后端 未结 3 1875
你的背包
你的背包 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:10

    https://stackoverflow.com/a/12372670/1961561 could be a solution for your problem.

    $.ajax({
      url: "/test",
      headers: {"X-Test-Header": "test-value"}
    });
    

提交回复
热议问题