這是我的全code ...否「訪問控制允許來源」標頭在辦理Ionic2 HTTP POST請求
this.http.post(link, data, { headers: headers })
.map(res => res.json())
.subscribe(data => {
this.data.response = data._body;
}, error => {
console.log("Oooops!");
});
運行代碼後,這個錯誤存在:
"XMLHttpRequest cannot load
https://script.google.com/macros/s/AKfycbzdHHKBmLWJYZtFGlJGOrUwlPIWXor1geEOgcSgvhs/dev.
No 'Access-Control-Allow-Origin' header is present on the requested resource.
Origin 'http://localhost:8100' is therefore not allowed access.
The response had HTTP status code 401."
我搜索關於CORS ...但我不能讓我的頭周圍...
任何幫助將不勝感激。
Duplicate:http://stackoverflow.com/questions/30132885/ionic-app-cannot-connect-cors-enabled-server-with-http – Quentin
相關:http://stackoverflow.com/questions/35553500/xmlhttprequest -cannot-load-https-www-website-com/ – Quentin
你正在發送你的POST請求的鏈接沒有來自服務器的訪問權限來訪問它請求的任何信息......它是客戶端到位的安全機制服務器通信 – repzero