chrome extension: refuse header “date” in ajax request

前端 未结 3 1045
离开以前
离开以前 2021-01-12 08:16

I have a javascript code to be used for api (ajax) and I need to send header \"date\" to api-server (required header), but chrome tells me \'refused to set unsafe header \"D

3条回答
  •  野趣味
    野趣味 (楼主)
    2021-01-12 09:02

    You can't. Since you are sending a XHR request it MUST be terminated according to the standard when you set a whole list of prohibited headers:

    http://www.w3.org/TR/XMLHttpRequest2/#the-setrequestheader-method

    You'll need to proxy through your originating url or some other work around.

提交回复
热议问题