次のエラー メッセージが表示されます。
Refused to set unsafe header "Origin"
このコードの使用:
function getResponse() {
document.getElementById("_receivedMsgLabel").innerHTML += "getResponse() called.<br/>";
if (receiveReq.readyState == 4 || receiveReq.readyState == 0) {
receiveReq.open("GET", "http://L45723:1802", true, "server", "server123"); //must use L45723:1802 at work.
receiveReq.onreadystatechange = handleReceiveMessage;
receiveReq.setRequestHeader("Origin", "http://localhost/");
receiveReq.setRequestHeader("Access-Control-Request-Origin", "http://localhost");
receiveReq.timeout = 0;
var currentDate = new Date();
var sendMessage = JSON.stringify({
SendTimestamp: currentDate,
Message: "Message 1",
Browser: navigator.appName
});
receiveReq.send(sendMessage);
}
}
私は何を間違っていますか?この CORS リクエストを機能させるには、ヘッダーに何が欠けていますか?
通話を削除しようとしましたreceiveReq.setRequestHeader("Origin", ...)
が、Google Chrome が通話でアクセス エラーをスローしますreceiveReq.open()
...
なんで?